public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: Thorsten Kukuk <kukuk@suse.de>
Cc: libc-hacker@sources.redhat.com
Subject: Re: asprintf/psignal.c change really correct?
Date: Mon, 14 Jun 2004 18:16:00 -0000	[thread overview]
Message-ID: <je1xki0zuc.fsf@sykes.suse.de> (raw)
In-Reply-To: <20040614171428.GA22354@suse.de> (Thorsten Kukuk's message of "Mon, 14 Jun 2004 19:14:28 +0200")

Thorsten Kukuk <kukuk@suse.de> writes:

> 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.

This should work:

2004-06-14  Andreas Schwab  <schwab@suse.de>

	* stdio-common/psignal.c (psignal): Don't use buf when asprintf
	failed.

--- stdio-common/psignal.c	03 Jun 2004 12:59:50 +0200	1.11
+++ stdio-common/psignal.c	14 Jun 2004 20:11:58 +0200	
@@ -64,12 +64,14 @@ psignal (int sig, const char *s)
 	  else
 	    (void) fprintf (stderr, "%s%s%s\n", s, colon, _("Unknown signal"));
 	}
-
-      if (_IO_fwide (stderr, 0) > 0)
-	(void) __fwprintf (stderr, L"%s",  buf);
       else
-	(void) fputs (buf, stderr);
+	{
+	  if (_IO_fwide (stderr, 0) > 0)
+	    (void) __fwprintf (stderr, L"%s",  buf);
+	  else
+	    (void) fputs (buf, stderr);
 
-      free (buf);
+	  free (buf);
+	}
     }
 }

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-14 17:14 Thorsten Kukuk
2004-06-14 18:16 ` Andreas Schwab [this message]
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=je1xki0zuc.fsf@sykes.suse.de \
    --to=schwab@suse.de \
    --cc=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).