Browse Source

[Pal] Return proper exit code on abnormal process termination

Rafał Wojdyła 6 years ago
parent
commit
f467a9871a
2 changed files with 4 additions and 2 deletions
  1. 3 1
      Pal/src/db_exception.c
  2. 1 1
      Pal/src/slab.c

+ 3 - 1
Pal/src/db_exception.c

@@ -32,6 +32,8 @@
 #include "list.h"
 #include "pal_debug.h"
 
+#include <errno.h>
+
 #define INIT_EVENT_HANDLER      { .lock = LOCK_INIT }
 
 struct pal_event_handler {
@@ -87,7 +89,7 @@ void DkExceptionReturn (PAL_PTR event)
 
 /* This does not return */
 void __abort(void) {
-    _DkProcessExit(1);
+    _DkProcessExit(-ENOTRECOVERABLE);
 }
 
 void warn (const char *format, ...)

+ 1 - 1
Pal/src/slab.c

@@ -127,7 +127,7 @@ void * malloc (size_t size)
          * condition and must terminate the current process.
          */
         printf("******** Out-of-memory in PAL ********\n");
-        _DkProcessExit(-1);
+        _DkProcessExit(-ENOMEM);
     }
 
 #if PROFILING == 1