diff options
author | Sverker Eriksson <[email protected]> | 2016-06-28 19:37:43 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2016-06-28 19:37:43 +0200 |
commit | 895c08431ff48b9451fa882d508e9f8201396186 (patch) | |
tree | 86e3e4c3313da98efcbf9b928614014014ae7bdb | |
parent | 3b7a6ffddc819bf305353a593904cea9e932e7dc (diff) | |
download | otp-895c08431ff48b9451fa882d508e9f8201396186.tar.gz otp-895c08431ff48b9451fa882d508e9f8201396186.tar.bz2 otp-895c08431ff48b9451fa882d508e9f8201396186.zip |
erts: Save abort reason for erl_child_setup
Nice to have for core dump inspection when stderr -> /dev/null.
-rw-r--r-- | erts/emulator/sys/unix/erl_child_setup.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/erts/emulator/sys/unix/erl_child_setup.c b/erts/emulator/sys/unix/erl_child_setup.c index 6beb316350..de61726e5b 100644 --- a/erts/emulator/sys/unix/erl_child_setup.c +++ b/erts/emulator/sys/unix/erl_child_setup.c @@ -54,6 +54,7 @@ #include <stdlib.h> #include <stdio.h> +#include <stdarg.h> #include <sys/wait.h> #define WANT_NONBLOCKING @@ -79,10 +80,17 @@ #define DEBUG_PRINT(fmt, ...) #endif -#define ABORT(fmt, ...) do { \ - fprintf(stderr, "erl_child_setup: " fmt "\r\n", ##__VA_ARGS__); \ - abort(); \ - } while(0) +static char abort_reason[200]; /* for core dump inspection */ + +static void ABORT(const char* fmt, ...) +{ + va_list arglist; + va_start(arglist, fmt); + vsprintf(abort_reason, fmt, arglist); + fprintf(stderr, "erl_child_setup: %s\r\n", abort_reason); + va_end(arglist); + abort(); +} #ifdef DEBUG void |