Change strerror so that it never returns an empty string.
authorBruno Haible <bruno@clisp.org>
Fri, 26 Oct 2007 22:41:22 +0000 (00:41 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 26 Oct 2007 22:41:22 +0000 (00:41 +0200)
ChangeLog
lib/strerror.c

index 877b665..e5ea16c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-10-26  Bruno Haible  <bruno@clisp.org>
+
+       * lib/strerror.c (rpl_strerror): Return "Unknown error ..." also if
+       strerror returned the empty string. Needed on HP-UX 11.00.
+
 2007-10-24  Micah Cowan  <micah@cowan.name>
 
        Remove vestiges of cvs-gnulib-checkout process.  Now we use git.
index 9b9ffd1..9fe437d 100644 (file)
@@ -35,7 +35,7 @@ rpl_strerror (int n)
 {
   char *result = strerror (n);
 
-  if (! result)
+  if (result == NULL || result[0] == '\0')
     {
       static char const fmt[] = "Unknown error (%d)";
       static char mesg[sizeof fmt + INT_STRLEN_BOUND (n)];