From 895c08431ff48b9451fa882d508e9f8201396186 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Tue, 28 Jun 2016 19:37:43 +0200 Subject: erts: Save abort reason for erl_child_setup Nice to have for core dump inspection when stderr -> /dev/null. --- erts/emulator/sys/unix/erl_child_setup.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'erts/emulator/sys/unix') 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 #include +#include #include #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 -- cgit v1.2.3