public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* asprintf/psignal.c change really correct?
@ 2004-06-14 17:14 Thorsten Kukuk
  2004-06-14 18:16 ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Thorsten Kukuk @ 2004-06-14 17:14 UTC (permalink / raw)
  To: libc-hacker


Hi,

We have the following change in current glibc CVS.
I don't think that it is correct: if asprintf fails, we
use fprintf or fwprintf. But than we access buf and try to
print the content. But buf is undefined here.

  Thorsten

--- old/glibc-2.3/stdio-common/psignal.c        2004-03-19 08:30:54.000000000 +0100
+++ new/glibc-2.3/stdio-common/psignal.c        2004-06-14 17:03:29.000000000 +0200
@@ -57,7 +57,13 @@
     {
       char *buf;
 
-      (void) __asprintf (&buf, _("%s%sUnknown signal %d\n"), s, colon, sig);
+      if (__asprintf (&buf, _("%s%sUnknown signal %d\n"), s, colon, sig) < 0)
+       {
+         if (_IO_fwide (stderr, 0) > 0)
+           (void) __fwprintf (stderr, L"%s%s%s\n", s, colon, _("Unknown signal"));
+         else
+           (void) fprintf (stderr, "%s%s%s\n", s, colon, _("Unknown signal"));
+       }
 
       if (_IO_fwide (stderr, 0) > 0)
        (void) __fwprintf (stderr, L"%s",  buf);

-- 
Thorsten Kukuk       http://www.suse.de/~kukuk/        kukuk@suse.de
SuSE Linux AG        Maxfeldstr. 5                 D-90409 Nuernberg
--------------------------------------------------------------------    
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-06-15 20:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-14 17:14 asprintf/psignal.c change really correct? Thorsten Kukuk
2004-06-14 18:16 ` Andreas Schwab
2004-06-15 20:04   ` Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).