From 2a9fe8b21de80fce75f1b285bc7ddc7aaa20f49c Mon Sep 17 00:00:00 2001 From: Kevin Adler Date: Mon, 18 Feb 2019 10:32:38 -0600 Subject: [PATCH 1/2] Fix bug #77677: WCOREDUMP not available on all systems Add #ifdef WCOREDUMP around all uses --- sapi/fpm/fpm/fpm_children.c | 4 ++++ sapi/litespeed/lsapilib.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/sapi/fpm/fpm/fpm_children.c b/sapi/fpm/fpm/fpm_children.c index bda85ef5a86b7..eed0c6757a750 100644 --- a/sapi/fpm/fpm/fpm_children.c +++ b/sapi/fpm/fpm/fpm_children.c @@ -204,7 +204,11 @@ void fpm_children_bury() /* {{{ */ } else if (WIFSIGNALED(status)) { const char *signame = fpm_signal_names[WTERMSIG(status)]; +#ifdef WCOREDUMP const char *have_core = WCOREDUMP(status) ? " - core dumped" : ""; +#else + const char* have_core = ""; +#endif if (signame == NULL) { signame = ""; diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c index c72c0e3aa2dff..4c9c62757cf35 100644 --- a/sapi/litespeed/lsapilib.c +++ b/sapi/litespeed/lsapilib.c @@ -2819,7 +2819,12 @@ static void lsapi_sigchild( int signal ) if ( WIFSIGNALED( status )) { int sig_num = WTERMSIG( status ); + +#ifdef WCOREDUMP int dump = WCOREDUMP( status ); +#else + int dump = -1; +#endif lsapi_log("Child process with pid: %d was killed by signal: " "%d, core dump: %d\n", pid, sig_num, dump ); } From bcf6409053bca7c9b0a507d568ec96112c9a0838 Mon Sep 17 00:00:00 2001 From: Kevin Adler Date: Thu, 28 Feb 2019 16:47:14 -0600 Subject: [PATCH 2/2] Change core dump message to yes/no/unknown in lsapilib --- sapi/litespeed/lsapilib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c index 4c9c62757cf35..7fc996a896415 100644 --- a/sapi/litespeed/lsapilib.c +++ b/sapi/litespeed/lsapilib.c @@ -2821,12 +2821,12 @@ static void lsapi_sigchild( int signal ) int sig_num = WTERMSIG( status ); #ifdef WCOREDUMP - int dump = WCOREDUMP( status ); + const char * dump = WCOREDUMP( status ) ? "yes" : "no"; #else - int dump = -1; + const char * dump = "unknown"; #endif lsapi_log("Child process with pid: %d was killed by signal: " - "%d, core dump: %d\n", pid, sig_num, dump ); + "%d, core dump: %s\n", pid, sig_num, dump ); } if ( pid == s_pid_dump_debug_info ) {