From c5553788bd572ef7b42c21524b602cda2cbb339a Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Tue, 12 Apr 2022 19:00:29 +0200 Subject: restore errno in error handler --- reap.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/reap.c b/reap.c index 36e3884..94ed3bd 100644 --- a/reap.c +++ b/reap.c @@ -37,9 +37,15 @@ void start_slaying(int sig) { (void)sig; + + int old_errno = errno; + if (verbose) - write(2, "reap: slaying\n", 14); // async safe + write(2, "reap: slaying\n", 14); + do_slay = 1; + + errno = old_errno; } // needs CONFIG_PROC_CHILDREN=y (since Linux 4.2), most modern distros have this -- cgit 1.4.1