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.
This commit is contained in:
Oran Agra 2022-03-22 17:37:34 +02:00 committed by GitHub
parent f3855a0930
commit 6761d10cc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1952,7 +1952,7 @@ void sigsegvHandler(int sig, siginfo_t *info, void *secret) {
serverLog(LL_WARNING, serverLog(LL_WARNING,
"Accessing address: %p", (void*)info->si_addr); "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, "Killed by PID: %ld, UID: %d", (long) info->si_pid, info->si_uid);
} }