This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] misc/syslog.c (openlog_internal): Fix __have_sock_cloexec initialization


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

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]