aboutsummaryrefslogtreecommitdiff
path: root/string/stratcliff.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-11-24 05:51:45 +0000
committerUlrich Drepper <drepper@redhat.com>1999-11-24 05:51:45 +0000
commit76e680a87a3f24c4e200e1064c65d7269c4c189c (patch)
treed69e34d7309125a0fca5632f5236008e6fd7129c /string/stratcliff.c
parentbd979c005c2558ba492cdca8e3b1ad4bdbbda4b7 (diff)
downloadglibc-76e680a87a3f24c4e200e1064c65d7269c4c189c.zip
glibc-76e680a87a3f24c4e200e1064c65d7269c4c189c.tar.gz
glibc-76e680a87a3f24c4e200e1064c65d7269c4c189c.tar.bz2
Update.
* string/stratcliff.c: Add one more strchr test for something which was reported to not work (which proofed to be wrong).
Diffstat (limited to 'string/stratcliff.c')
-rw-r--r--string/stratcliff.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/string/stratcliff.c b/string/stratcliff.c
index d8b0bd1..10ddc47 100644
--- a/string/stratcliff.c
+++ b/string/stratcliff.c
@@ -1,5 +1,5 @@
/* Test for string function add boundaries of usable memory.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -42,10 +42,10 @@ main (int argc, char *argv[])
char *adr, *dest;
int result = 0;
- adr = (char *) mmap (NULL, 3 * size, PROT_READ|PROT_WRITE,
- MAP_PRIVATE|MAP_ANON, -1, 0);
- dest = (char *) mmap (NULL, 3*size, PROT_READ|PROT_WRITE,
- MAP_PRIVATE|MAP_ANON, -1, 0);
+ adr = (char *) mmap (NULL, 3 * size, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANON, -1, 0);
+ dest = (char *) mmap (NULL, 3 * size, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANON, -1, 0);
if (adr == MAP_FAILED || dest == MAP_FAILED)
{
if (errno == ENOSYS)
@@ -61,11 +61,11 @@ main (int argc, char *argv[])
int inner, middle, outer;
mprotect(adr, size, PROT_NONE);
- mprotect(adr+2*size, size, PROT_NONE);
+ mprotect(adr + 2 * size, size, PROT_NONE);
adr += size;
mprotect(dest, size, PROT_NONE);
- mprotect(dest+2*size, size, PROT_NONE);
+ mprotect(dest + 2 * size, size, PROT_NONE);
dest += size;
memset (adr, 'T', size);
@@ -116,6 +116,14 @@ main (int argc, char *argv[])
}
}
+ /* Special test. */
+ adr[size - 1] = '\0';
+ if (strchr (&adr[size - 1], '\n') != NULL)
+ {
+ puts ("strchr flunked for test of empty string at end of page");
+ result = 1;
+ }
+
/* strrchr test */
for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
{