This is the mail archive of the
mailing list for the glibc project.
[PATCH roland/libc_fatal-no-syslog] Do not call syslog in __libc_message.
- From: Roland McGrath <roland at hack dot frob dot com>
- To: "GNU C. Library" <libc-alpha at sourceware dot org>
- Date: Wed, 20 Mar 2013 14:57:37 -0700 (PDT)
- Subject: [PATCH roland/libc_fatal-no-syslog] Do not call syslog in __libc_message.
I was shocked and horrified when I realized that __libc_message
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.
2013-03-20 Roland McGrath <email@example.com>
* sysdeps/posix/libc_fatal.c: Don't include <sys/syslog.h>.
(__libc_message): Never call vsyslog.
@@ -29,7 +29,6 @@
@@ -68,11 +67,9 @@ void
__libc_message (int do_abort, const char *fmt, ...)
- va_list ap_copy;
int fd = -1;
va_start (ap, fmt);
- va_copy (ap_copy, ap);
@@ -170,12 +167,6 @@ __libc_message (int do_abort, const char *fmt, ...)
- /* If we had no success writing the message, use syslog. */
- if (! written)
- vsyslog (LOG_ERR, fmt, ap_copy);
- va_end (ap_copy);
BEFORE_ABORT (do_abort, written, fd);