[PATCH] misc/syslog.c (openlog_internal): Fix __have_sock_cloexec initialization
Dmitry V. Levin
ldv@altlinux.org
Wed Oct 22 18:06:00 GMT 2008
Hi,
Current glibc's openlog/syslog is totally broken on linux < 2.6.27.
Current behavior:
$ strace -qe socket,fcntl logger foo
socket(PF_FILE, SOCK_DGRAM|SOCK_CLOEXEC, 0) = -1 EINVAL (Invalid argument)
Expected behavior:
$ strace -qe socket,fcntl logger foo
socket(PF_FILE, SOCK_DGRAM|SOCK_CLOEXEC, 0) = -1 EINVAL (Invalid argument)
socket(PF_FILE, SOCK_DGRAM, 0) = 1
fcntl(1, F_SETFD, FD_CLOEXEC) = 0
2008-10-22 Dmitry V. Levin <ldv@altlinux.org>
* misc/syslog.c (openlog_internal): Fix __have_sock_cloexec
initialization.
--- misc/syslog.c
+++ misc/syslog.c
@@ -424,9 +424,9 @@ openlog_internal(const char *ident, int logstat, int logfac)
if (__have_sock_cloexec == 0)
__have_sock_cloexec
= (LogFile != -1
- || errno != EINVAL);
+ || errno != EINVAL) ? 1 : -1;
}
-#endif
+# endif
#endif
#ifndef __ASSUME_SOCK_CLOEXEC
# ifdef SOCK_CLOEXEC
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20081022/12aebc44/attachment.sig>
More information about the Libc-alpha
mailing list