Fix HP-UX $! failure
authorKarl Williamson <public@khwilliamson.com>
Sun, 15 Dec 2013 02:48:00 +0000 (19:48 -0700)
committerKarl Williamson <public@khwilliamson.com>
Tue, 17 Dec 2013 16:37:57 +0000 (09:37 -0700)
HP-UX strerror() returns an empty string for an unknown error code.
This caused an assertion to fail under DEBUGGING builds.  This patch
removes the assertion and changes the return into  a non-empty string
indicating the errno is for an unknown error.

mg.c

diff --git a/mg.c b/mg.c
index d296cbc3418f76b6f325db7147803b4503714600..45a8ac1691de5c0db818b54eeeab73b27f169d1c 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -748,7 +748,11 @@ S_fixup_errno_string(pTHX_ SV* sv)
     PERL_ARGS_ASSERT_FIXUP_ERRNO_STRING;
 
     assert(SvOK(sv));
-    assert(strNE(SvPVX(sv), ""));
+
+    if(strEQ(SvPVX(sv), "")) {
+       sv_catpv(sv, UNKNOWN_ERRNO_MSG);
+    }
+    else {
 
     /* In some locales the error string may come back as UTF-8, in
      * which case we should turn on that flag.  This didn't use to
@@ -768,6 +772,7 @@ S_fixup_errno_string(pTHX_ SV* sv)
     {
         SvUTF8_on(sv);
     }
+    }
 }
 
 #ifdef VMS