summaryrefslogtreecommitdiffhomepage
path: root/svr-chansession.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2014-02-15 21:13:57 +0800
committerMatt Johnston <matt@ucc.asn.au>2014-02-15 21:13:57 +0800
commit1dc5312f00c80e2f0b06838b671bf32d63936f41 (patch)
treea7c7262ca0e1d1c72646ffafb2280b2019b2d00c /svr-chansession.c
parent73444f2957f15e808d1c5d0547a1b4993dc2f160 (diff)
- Save errno in signal handlers
- Use _exit() in segv handler
Diffstat (limited to 'svr-chansession.c')
-rw-r--r--svr-chansession.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/svr-chansession.c b/svr-chansession.c
index dd9ea02..63e56a8 100644
--- a/svr-chansession.c
+++ b/svr-chansession.c
@@ -87,6 +87,8 @@ static void sesssigchild_handler(int UNUSED(dummy)) {
struct sigaction sa_chld;
struct exitinfo *exit = NULL;
+ const int saved_errno = errno;
+
TRACE(("enter sigchld handler"))
while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
TRACE(("sigchld handler: pid %d", pid))
@@ -140,6 +142,8 @@ static void sesssigchild_handler(int UNUSED(dummy)) {
sigemptyset(&sa_chld.sa_mask);
sigaction(SIGCHLD, &sa_chld, NULL);
TRACE(("leave sigchld handler"))
+
+ errno = saved_errno;
}
/* send the exit status or the signal causing termination for a session */