Skip to content

Commit

Permalink
2003-03-14 Roland McGrath <roland@redhat.com>
Browse files Browse the repository at this point in the history
	* dlfcn/dlerror.c (dlerror): If objname is "", don't put ": " after it.
  • Loading branch information
Roland McGrath committed Mar 15, 2003
1 parent eec0ca9 commit 4a8ff87
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions dlfcn/dlerror.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Return error detail for failing <dlfcn.h> functions.
Copyright (C) 1995,1996,1997,1998,1999,2000,2002
Copyright (C) 1995,1996,1997,1998,1999,2000,2002, 2003
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Expand Down Expand Up @@ -69,9 +69,19 @@ dlerror (void)
else if (result->errstring != NULL)
{
buf = (char *) result->errstring;
if (__asprintf (&buf, result->errcode != 0 ? "%s: %s: %s" : "%s: %s",
result->objname, _(result->errstring),
strerror (result->errcode)) != -1)
int n;
if (result->errcode == 0)
n = __asprintf (&buf, "%s%s%s",
result->objname,
result->objname[0] == '\0' ? "" : ": ",
_(result->errstring));
else
n = __asprintf (&buf, "%s%s%s: %s",
result->objname,
result->objname[0] == '\0' ? "" : ": ",
_(result->errstring),
strerror (result->errcode));
if (n != -1)
{
/* We don't need the error string anymore. */
if (strcmp (result->errstring, "out of memory") != 0)
Expand Down

0 comments on commit 4a8ff87

Please sign in to comment.