diff options
author | Florian Weimer <fweimer@redhat.com> | 2015-10-17 12:02:37 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2015-10-17 12:02:37 +0200 |
commit | 52fb79d6cdecb89a6f0375091e7c12ed79ae6760 (patch) | |
tree | e4885bfee90d7fe9f584518d3bc242050c725ef0 /sunrpc | |
parent | f546f87c4ffb1642ffc96b8d614c329ed35252c3 (diff) | |
download | glibc-52fb79d6cdecb89a6f0375091e7c12ed79ae6760.zip glibc-52fb79d6cdecb89a6f0375091e7c12ed79ae6760.tar.gz glibc-52fb79d6cdecb89a6f0375091e7c12ed79ae6760.tar.bz2 |
Assume that SOCK_CLOEXEC is available and works
This fixes (harmless) data races when accessing the various
__have_sock_cloexec variables.
Diffstat (limited to 'sunrpc')
-rw-r--r-- | sunrpc/clnt_udp.c | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c index 6ffa5f2..cc1da47 100644 --- a/sunrpc/clnt_udp.c +++ b/sunrpc/clnt_udp.c @@ -171,31 +171,7 @@ __libc_clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, cu->cu_xdrpos = XDR_GETPOS (&(cu->cu_outxdrs)); if (*sockp < 0) { -#ifdef SOCK_NONBLOCK -# ifndef __ASSUME_SOCK_CLOEXEC - if (__have_sock_cloexec >= 0) -# endif - { - *sockp = __socket (AF_INET, SOCK_DGRAM|SOCK_NONBLOCK|flags, - IPPROTO_UDP); -# ifndef __ASSUME_SOCK_CLOEXEC - if (__have_sock_cloexec == 0) - __have_sock_cloexec = *sockp >= 0 || errno != EINVAL ? 1 : -1; -# endif - } -#endif -#ifndef __ASSUME_SOCK_CLOEXEC -# ifdef SOCK_CLOEXEC - if (__have_sock_cloexec < 0) -# endif - { - *sockp = __socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP); -# ifdef SOCK_CLOEXEC - if (flags & SOCK_CLOEXEC) - __fcntl (*sockp, F_SETFD, FD_CLOEXEC); -# endif - } -#endif + *sockp = __socket (AF_INET, SOCK_DGRAM|SOCK_NONBLOCK|flags, IPPROTO_UDP); if (__glibc_unlikely (*sockp < 0)) { struct rpc_createerr *ce = &get_rpc_createerr (); @@ -205,16 +181,6 @@ __libc_clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, } /* attempt to bind to prov port */ (void) bindresvport (*sockp, (struct sockaddr_in *) 0); -#ifndef __ASSUME_SOCK_CLOEXEC -# ifdef SOCK_CLOEXEC - if (__have_sock_cloexec < 0) -# endif - { - /* the sockets rpc controls are non-blocking */ - int dontblock = 1; - (void) __ioctl (*sockp, FIONBIO, (char *) &dontblock); - } -#endif #ifdef IP_RECVERR { int on = 1; |