public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Thorsten Kukuk <kukuk@suse.de>
To: libc-hacker@sources.redhat.com
Subject: asprintf/psignal.c change really correct?
Date: Mon, 14 Jun 2004 17:14:00 -0000	[thread overview]
Message-ID: <20040614171428.GA22354@suse.de> (raw)


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

             reply	other threads:[~2004-06-14 17:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-14 17:14 Thorsten Kukuk [this message]
2004-06-14 18:16 ` Andreas Schwab
2004-06-15 20:04   ` Roland McGrath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040614171428.GA22354@suse.de \
    --to=kukuk@suse.de \
    --cc=libc-hacker@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).