From: Ulrich Drepper Date: Sun, 6 Mar 2005 20:56:52 +0000 (+0000) Subject: (recv): Avoid calls to the _chk variant if we know the call succeeds. (recvfrom)... X-Git-Tag: cvs/fedora-glibc-20050319T1907~38 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4625abbf26ae8ca7bd49a00de0c744136323699b;p=thirdparty%2Fglibc.git (recv): Avoid calls to the _chk variant if we know the call succeeds. (recvfrom): Likewise. --- diff --git a/socket/bits/socket2.h b/socket/bits/socket2.h index 0ccb24ca31b..e752879e6e8 100644 --- a/socket/bits/socket2.h +++ b/socket/bits/socket2.h @@ -25,6 +25,7 @@ extern ssize_t __recv_chk (int __fd, void *__buf, size_t __n, size_t __buflen, int __flags); #define recv(fd, buf, n, flags) \ (__bos0 (buf) != (size_t) -1 \ + && (!__builtin_constant_p (n) || (n) > __bos0 (buf)) \ ? __recv_chk (fd, buf, n, __bos0 (buf), flags) \ : recv (fd, buf, n, flags)) @@ -34,5 +35,6 @@ extern ssize_t __recvfrom_chk (int __fd, void *__restrict __buf, size_t __n, socklen_t *__restrict __addr_len); #define recvfrom(fd, buf, n, flags, addr, addr_len) \ (__bos0 (buf) != (size_t) -1 \ + && (!__builtin_constant_p (n) || (n) > __bos0 (buf)) \ ? __recvfrom_chk (fd, buf, n, __bos0 (buf), flags, addr, addr_len) \ : recvfrom (fd, buf, n, flags, addr, addr_len))