diff options
Diffstat (limited to 'string')
-rw-r--r-- | string/argz.h | 9 | ||||
-rw-r--r-- | string/stratcliff.c | 19 | ||||
-rw-r--r-- | string/string.h | 28 |
3 files changed, 31 insertions, 25 deletions
diff --git a/string/argz.h b/string/argz.h index b6906d976e..d7814fdd2e 100644 --- a/string/argz.h +++ b/string/argz.h @@ -110,7 +110,7 @@ extern char *argz_next __P ((char *argz, size_t __argz_len, #if defined (__OPTIMIZE__) && __GNUC__ >= 2 extern inline char * -__argz_next (char *__argz, size_t __argz_len, const char *__entry) +__argz_next (char *__argz, size_t __argz_len, __const char *__entry) { if (__entry) { @@ -120,13 +120,10 @@ __argz_next (char *__argz, size_t __argz_len, const char *__entry) return __entry >= __argz + __argz_len ? NULL : (char *) __entry; } else - if (__argz_len > 0) - return __argz; - else - return 0; + return __argz_len > 0 ? __argz : 0; } extern inline char * -argz_next (char *__argz, size_t __argz_len, const char *__entry) +argz_next (char *__argz, size_t __argz_len, __const char *__entry) { return __argz_next (__argz, __argz_len, __entry); } diff --git a/string/stratcliff.c b/string/stratcliff.c index 5f6a467c15..10c1f1f6b7 100644 --- a/string/stratcliff.c +++ b/string/stratcliff.c @@ -14,12 +14,14 @@ int main (int argc, char *argv[]) { size_t size = sysconf (_SC_PAGESIZE); - char *adr; + char *adr, *dest; int result = 0; - adr = (char *) mmap (NULL, size, PROT_READ|PROT_WRITE, - MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); - if (adr == NULL) + adr = (char *) mmap (NULL, 3 * size, PROT_READ|PROT_WRITE, + MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); + dest = (char *) mmap (NULL, 3*size, PROT_READ|PROT_WRITE, + MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); + if (adr == (char *)-1L || dest == (char *)-1L) { if (errno == ENOSYS) puts ("No test, mmap not available."); @@ -31,9 +33,16 @@ main (int argc, char *argv[]) } else { - char dest[size]; int inner, middle, outer; + mprotect(adr, size, PROT_NONE); + mprotect(adr+2*size, size, PROT_NONE); + adr += size; + + mprotect(dest, size, PROT_NONE); + mprotect(dest+2*size, size, PROT_NONE); + dest += size; + memset (adr, 'T', size); /* strlen test */ diff --git a/string/string.h b/string/string.h index a8b34b2b33..414f2cb22a 100644 --- a/string/string.h +++ b/string/string.h @@ -1,23 +1,23 @@ /* Copyright (C) 1991, 92, 93, 95, 96 Free Software Foundation, Inc. -This file is part of the GNU C Library. + This file is part of the GNU C Library. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ /* - * ANSI Standard: 4.11 STRING HANDLING <string.h> + * ISO C Standard: 4.11 STRING HANDLING <string.h> */ #ifndef _STRING_H |