diff --git a/src/script.c b/src/script.c index fced3ac..acd4468 100644 --- a/src/script.c +++ b/src/script.c @@ -35,6 +35,7 @@ static pid_t script = 0; static void handler(int signo) { + int save_errno = errno; int status; pid_t pid = 1; @@ -55,6 +56,7 @@ static void handler(int signo) smclog(LOG_WARNING, "Script %s returned error: %d", exec, status); } } + errno = save_errno; } int script_init(char *script) diff --git a/src/timer.c b/src/timer.c index 56e0d27..b0d8e48 100644 --- a/src/timer.c +++ b/src/timer.c @@ -164,9 +164,12 @@ static void run(int sd, void *arg) /* write to pipe to create an event for select() on SIGALRM */ static void handler(int signo) { + int save_errno = errno; + (void)signo; if (write(timerfd[1], "!", 1) < 0) smclog(LOG_DEBUG, "Failed write(pipe): %s", strerror(errno)); + errno = save_errno; } /*