about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2022-04-12 19:00:29 +0200
committerLeah Neukirchen <leah@vuxu.org>2022-04-12 19:00:29 +0200
commitc5553788bd572ef7b42c21524b602cda2cbb339a (patch)
treeef789c42818e042ff59d8572a628fddf4c30b811
parent0e68d09804fb9ec82af37045fb37c2ceefa391d5 (diff)
downloadreap-master.tar.gz
reap-master.tar.xz
reap-master.zip
restore errno in error handler HEAD master
-rw-r--r--reap.c8
1 files changed, 7 insertions, 1 deletions
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