From ad908168ff437dff727697448d4ef8d34fc2edc7 Mon Sep 17 00:00:00 2001 From: Nedko Arnaudov Date: Fri, 5 Jul 2024 16:32:30 +0300 Subject: [PATCH] daemon/loader.c: save&restore errno in SIGCHLD handler --- daemon/loader.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/daemon/loader.c b/daemon/loader.c index ba569971..dff71452 100644 --- a/daemon/loader.c +++ b/daemon/loader.c @@ -171,6 +171,9 @@ static void loader_sigchld_handler(int signum) pid_t pid; struct loader_child *child_ptr; int signal; + int errno_saved; + + errno_saved = errno; ASSERT(signum == SIGCHLD); @@ -213,6 +216,8 @@ static void loader_sigchld_handler(int signum) log_info("Child was stopped by signal %d", WSTOPSIG(status)); } } + + errno = errno_saved; } void loader_init(void (* on_child_exit)(pid_t pid, int exit_status))