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 /misc | |
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 'misc')
-rw-r--r-- | misc/syslog.c | 33 |
1 files changed, 3 insertions, 30 deletions
diff --git a/misc/syslog.c b/misc/syslog.c index e387bf8..6922ad6 100644 --- a/misc/syslog.c +++ b/misc/syslog.c @@ -346,36 +346,9 @@ openlog_internal(const char *ident, int logstat, int logfac) (void)strncpy(SyslogAddr.sun_path, _PATH_LOG, sizeof(SyslogAddr.sun_path)); if (LogStat & LOG_NDELAY) { -#ifdef SOCK_CLOEXEC -# ifndef __ASSUME_SOCK_CLOEXEC - if (__have_sock_cloexec >= 0) { -# endif - LogFile = __socket(AF_UNIX, - LogType - | SOCK_CLOEXEC, 0); -# ifndef __ASSUME_SOCK_CLOEXEC - if (__have_sock_cloexec == 0) - __have_sock_cloexec - = ((LogFile != -1 - || errno != EINVAL) - ? 1 : -1); - } -# endif -#endif -#ifndef __ASSUME_SOCK_CLOEXEC -# ifdef SOCK_CLOEXEC - if (__have_sock_cloexec < 0) -# endif - LogFile = __socket(AF_UNIX, LogType, 0); -#endif - if (LogFile == -1) - return; -#ifndef __ASSUME_SOCK_CLOEXEC -# ifdef SOCK_CLOEXEC - if (__have_sock_cloexec < 0) -# endif - __fcntl(LogFile, F_SETFD, FD_CLOEXEC); -#endif + LogFile = __socket(AF_UNIX, LogType | SOCK_CLOEXEC, 0); + if (LogFile == -1) + return; } } if (LogFile != -1 && !connected) |