summary refs log tree commit diff
path: root/dlfcn
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2003-03-15 20:06:37 +0000
committerRoland McGrath <roland@gnu.org>2003-03-15 20:06:37 +0000
commit4a8ff87cac00e23a9733e4a5332cb52090d8910e (patch)
tree59596531a0d73d2b52320537c15d96257248da34 /dlfcn
parenteec0ca9f259d04db3e0dde1ad1d89fce32f72b8c (diff)
downloadglibc-4a8ff87cac00e23a9733e4a5332cb52090d8910e.tar.gz
glibc-4a8ff87cac00e23a9733e4a5332cb52090d8910e.tar.xz
glibc-4a8ff87cac00e23a9733e4a5332cb52090d8910e.zip
2003-03-14 Roland McGrath <roland@redhat.com>
	* dlfcn/dlerror.c (dlerror): If objname is "", don't put ": " after it.
Diffstat (limited to 'dlfcn')
-rw-r--r--dlfcn/dlerror.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/dlfcn/dlerror.c b/dlfcn/dlerror.c
index eaf5ef9294..0e02ca7d90 100644
--- a/dlfcn/dlerror.c
+++ b/dlfcn/dlerror.c
@@ -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.
 
@@ -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)