diff options
author | Ulrich Drepper <drepper@redhat.com> | 2005-03-01 00:35:23 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2005-03-01 00:35:23 +0000 |
commit | 61062f56304750c367c5c1533351621353c112a7 (patch) | |
tree | 30cff0c1f42e6eb794c5b7e41145e6cc93802d91 /posix | |
parent | cffa6970f9785ffcb2a60249b1aca6a2cfde4af3 (diff) | |
download | glibc-61062f56304750c367c5c1533351621353c112a7.zip glibc-61062f56304750c367c5c1533351621353c112a7.tar.gz glibc-61062f56304750c367c5c1533351621353c112a7.tar.bz2 |
* posix/bits/unistd.h: Avoid calling __*_chk variants if we can
determine the call will never trigger a failure.
* sysdeps/i386/i686/memset_chk.S: Remove alias and warning.
* sysdeps/x86_64/memset_chk.S: Likewise.
2005-02-24 Roland McGrath <roland@redhat.com>
* debug/Versions (libc: GLIBC_2.4): Remove
__memset_zero_constant_len_parameter.
* sysdeps/generic/memset_chk.c: Remove alias and warning.
* misc/sys/cdefs.h (__warndecl): New macro.
* debug/warning-nop.c: New file.
* string/bits/string3.h (memset): Call __warn_memset_zero_len with no
arguments, instead of calling __memset_zero_constant_len_parameter.
Use __warndecl for __warn_memset_zero_len.
* debug/Makefile (routines): Add $(static-only-routines).
(static-only-routines): New variable.
Diffstat (limited to 'posix')
-rw-r--r-- | posix/bits/unistd.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h index 3b9c67c..0e5417c 100644 --- a/posix/bits/unistd.h +++ b/posix/bits/unistd.h @@ -25,6 +25,7 @@ extern ssize_t __read_chk (int __fd, void *__buf, size_t __nbytes, size_t __buflen) __wur; #define read(fd, buf, nbytes) \ (__bos (buf) != (size_t) -1 \ + && (!__builtin_constant_p (nbytes) || (nbytes) > __bos (buf)) \ ? __read_chk (fd, buf, nbytes, __bos (buf)) \ : read (fd, buf, nbytes)) @@ -36,11 +37,13 @@ extern ssize_t __pread64_chk (int __fd, void *__buf, size_t __nbytes, # ifndef __USE_FILE_OFFSET64 # define pread(fd, buf, nbytes, offset) \ (__bos (buf) != (size_t) -1 \ + && (!__builtin_constant_p (nbytes) || (nbytes) > __bos (buf)) \ ? __pread64_chk (fd, buf, nbytes, offset, __bos (buf)) \ : pread (fd, buf, offset, nbytes)) # else # define pread(fd, buf, nbytes, offset) \ (__bos (buf) != (size_t) -1 \ + && (!__builtin_constant_p (nbytes) || (nbytes) > __bos (buf)) \ ? __pread_chk (fd, buf, nbytes, offset, __bos (buf)) \ : pread (fd, buf, offset, nbytes)) # endif @@ -48,6 +51,7 @@ extern ssize_t __pread64_chk (int __fd, void *__buf, size_t __nbytes, # ifdef __USE_LARGEFILE64 # define pread64(fd, buf, nbytes, offset) \ (__bos (buf) != (size_t) -1 \ + && (!__builtin_constant_p (nbytes) || (nbytes) > __bos (buf)) \ ? __pread64_chk (fd, buf, nbytes, offset, __bos (buf)) \ : pread64 (fd, buf, offset, nbytes)) # endif @@ -60,6 +64,7 @@ extern int __readlink_chk (__const char *__restrict __path, __THROW __nonnull ((1, 2)) __wur; # define readlink(path, buf, len) \ (__bos (buf) != (size_t) -1 \ + && (!__builtin_constant_p (len) || (len) > __bos (buf)) \ ? __readlink_chk (path, buf, len, __bos (buf)) \ : readlink (path, buf, len)) #endif @@ -68,6 +73,7 @@ extern char *__getcwd_chk (char *__buf, size_t __size, size_t __buflen) __THROW __wur; #define getcwd(buf, size) \ (__bos (buf) != (size_t) -1 \ + && (!__builtin_constant_p (size) || (size) > __bos (buf)) \ ? __getcwd_chk (buf, size, buflen) : getcwd (buf, size)) #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED |