aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-06-28 19:37:43 +0200
committerSverker Eriksson <[email protected]>2016-06-28 19:37:43 +0200
commit895c08431ff48b9451fa882d508e9f8201396186 (patch)
tree86e3e4c3313da98efcbf9b928614014014ae7bdb /erts/emulator
parent3b7a6ffddc819bf305353a593904cea9e932e7dc (diff)
downloadotp-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.
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/sys/unix/erl_child_setup.c16
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