From 280e6a89e4b119a4ee8f4bf3c1b747cf4e1352f1 Mon Sep 17 00:00:00 2001 From: Oran Agra Date: Tue, 22 Mar 2022 17:37:34 +0200 Subject: [PATCH] crash log, print killer pid only when si_code is SI_USER (#10454) Avoid printing "Killed by PID" when si_code != SI_USER. Apparently SI_USER isn't always set to 0. e.g. on Mac it's 0x10001 and the check that did <= was wrong. (cherry picked from commit 6761d10cc34a904982f28ca146bef0747abf3e06) --- src/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/debug.c b/src/debug.c index 7e9c643f6..2639d284d 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1642,7 +1642,7 @@ void sigsegvHandler(int sig, siginfo_t *info, void *secret) { serverLog(LL_WARNING, "Accessing address: %p", (void*)info->si_addr); } - if (info->si_code <= SI_USER && info->si_pid != -1) { + if (info->si_code == SI_USER && info->si_pid != -1) { serverLog(LL_WARNING, "Killed by PID: %ld, UID: %d", (long) info->si_pid, info->si_uid); } serverLog(LL_WARNING,