summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-07-28 23:34:19 +0000
committerJakub Jelinek <jakub@redhat.com>2008-07-28 23:34:19 +0000
commitc7045198ca8f4ff5b97205340d51127f8503c2bd (patch)
tree387ee7a78760f683df6035af28d665e3972aa30b /misc
parentc83494a925f4b4b716f9ba3abcb5e695d3e2a8a9 (diff)
Updated to fedora-glibc-20080728T2320cvs/fedora-glibc-2_8_90-10
Diffstat (limited to 'misc')
-rw-r--r--misc/syslog.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/misc/syslog.c b/misc/syslog.c
index 5781b4a964..baa180bb7b 100644
--- a/misc/syslog.c
+++ b/misc/syslog.c
@@ -348,10 +348,35 @@ openlog_internal(const char *ident, int logstat, int logfac)
(void)strncpy(SyslogAddr.sun_path, _PATH_LOG,
sizeof(SyslogAddr.sun_path));
if (LogStat & LOG_NDELAY) {
- if ((LogFile = __socket(AF_UNIX, LogType, 0))
- == -1)
+#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);
+#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;
- (void)__fcntl(LogFile, F_SETFD, 1);
+#ifndef __ASSUME_SOCK_CLOEXEC
+# ifdef SOCK_CLOEXEC
+ if (__have_sock_cloexec < 0)
+# endif
+ __fcntl(LogFile, F_SETFD, FD_CLOEXEC);
+#endif
}
}
if (LogFile != -1 && !connected)