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 roland/libc_fatal-no-syslog] Do not call syslog in __libc_message.


I was shocked and horrified when I realized that __libc_message
calls syslog.  

I vaguely understand the motivation.  If it fails to get the message
out to /dev/tty or stderr (presumably because there is none, though
the startup hooey is likely to arrange that stderr is open on
/dev/null rather than there being no fd 2 at all), then it wants to
get the information out somewhere and syslog is one possible way it
might see the light of day.

But I really think it's a bridge too far.  For every random program
to automatically connect to a system-wide service to report it is
crashing is just nutty.  For statically-linked programs, every
program even linking in code like syslog and thus connect, etc.
is really wacky--not to mention the gross name space violation here.

Other solutions exist for catching crashes in daemons and such.
This arcane crutch in libc is not the way to solve that problem.

Any objections?


Thanks,
Roland


2013-03-20  Roland McGrath  <roland@hack.frob.com>

	* sysdeps/posix/libc_fatal.c: Don't include <sys/syslog.h>.
	(__libc_message): Never call vsyslog.

--- a/sysdeps/posix/libc_fatal.c
+++ b/sysdeps/posix/libc_fatal.c
@@ -29,7 +29,6 @@
 #include <sysdep.h>
 #include <unistd.h>
 #include <sys/mman.h>
-#include <sys/syslog.h>
 #include <sys/uio.h>
 #include <not-cancel.h>
 
@@ -68,11 +67,9 @@ void
 __libc_message (int do_abort, const char *fmt, ...)
 {
   va_list ap;
-  va_list ap_copy;
   int fd = -1;
 
   va_start (ap, fmt);
-  va_copy (ap_copy, ap);
 
 #ifdef FATAL_PREPARE
   FATAL_PREPARE;
@@ -170,12 +167,6 @@ __libc_message (int do_abort, const char *fmt, ...)
 
   va_end (ap);
 
-  /* If we  had no success writing the message, use syslog.  */
-  if (! written)
-    vsyslog (LOG_ERR, fmt, ap_copy);
-
-  va_end (ap_copy);
-
   if (do_abort)
     {
       BEFORE_ABORT (do_abort, written, fd);


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