From 4625abbf26ae8ca7bd49a00de0c744136323699b Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 6 Mar 2005 20:56:52 +0000 Subject: (recv): Avoid calls to the _chk variant if we know the call succeeds. (recvfrom): Likewise. --- socket/bits/socket2.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'socket') diff --git a/socket/bits/socket2.h b/socket/bits/socket2.h index 0ccb24ca31..e752879e6e 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)) -- cgit 1.4.1