From: Ulrich Drepper Date: Thu, 23 Sep 2004 04:45:09 +0000 (+0000) Subject: Update. X-Git-Tag: upstream/2.30~17475 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=54915e9e373fdd0c15deca970ae4a04a17c598ad;p=external%2Fglibc.git Update. * malloc/malloc.c (malloc_printerr): Use syslog if writev failed. --- diff --git a/ChangeLog b/ChangeLog index 027a8c5..a23d0a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2004-09-22 Ulrich Drepper + * malloc/malloc.c (malloc_printerr): Use syslog if writev failed. + * string/string.h: Add __nonnull annotations. * stdlib/stdlib.h: Likewise. diff --git a/malloc/malloc.c b/malloc/malloc.c index 665d7a4..dcc54c4 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -285,6 +285,8 @@ extern "C" { /* For writev and struct iovec. */ #include + /* For syslog. */ +#include /* Debugging: @@ -5467,7 +5469,12 @@ malloc_printerr(int action, const char *str, void *ptr) iov[n].iov_base = cp; iov[n].iov_len = &buf[sizeof (buf) - 1] - cp; ++n; - TEMP_FAILURE_RETRY (__writev (STDERR_FILENO, iov, n)); + if (TEMP_FAILURE_RETRY (__writev (STDERR_FILENO, iov, n)) == -1 + && errno == EBADF) + /* Standard error is not opened. Try using syslog. */ + syslog (LOG_ERR, "%s%s%s", (char *) iov[0].iov_base, + (char *) iov[1].iov_base, + n == 3 ? (const char *) iov[2].iov_base : ""); } if (action & 2) abort ();