[win32] merge change#887 from maintbranch
[p5sagit/p5-mst-13.2.git] / perl.c
diff --git a/perl.c b/perl.c
index 88c0837..16c5b9f 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -2795,10 +2795,16 @@ my_failure_exit(void)
            STATUS_NATIVE_SET(vaxc$errno);
     }
 #else
+    int exitstatus;
     if (errno & 255)
        STATUS_POSIX_SET(errno);
-    else if (STATUS_POSIX == 0)
-       STATUS_POSIX_SET(255);
+    else {
+       exitstatus = STATUS_POSIX >> 8; 
+       if (exitstatus & 255)
+           STATUS_POSIX_SET(exitstatus);
+       else
+           STATUS_POSIX_SET(255);
+    }
 #endif
     my_exit_jump();
 }