summary refs log tree commit diff
path: root/calmwm.c
diff options
context:
space:
mode:
authortobias <tobias>2008-05-06 15:12:04 +0000
committertobias <tobias>2008-05-06 15:12:04 +0000
commit458f96936dfd720466f17861f15ab4d9dc703350 (patch)
tree36c73fca8608f7d61aa3b5ed2301a282504714f7 /calmwm.c
parentcd0ce468175113c2bd7fdae285a7fe508151fc5b (diff)
downloadcwm-458f96936dfd720466f17861f15ab4d9dc703350.tar.gz
cwm-458f96936dfd720466f17861f15ab4d9dc703350.tar.xz
cwm-458f96936dfd720466f17861f15ab4d9dc703350.zip
Signal handler of SIGCHLD calls waitpid() which sets errno on error. To
avoid clubbering of errno in normal context, save_errno got introduced.

ok oga
Diffstat (limited to 'calmwm.c')
-rw-r--r--calmwm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/calmwm.c b/calmwm.c
index da8aa4b..a9e84d9 100644
--- a/calmwm.c
+++ b/calmwm.c
@@ -300,12 +300,15 @@ static void
 _sigchld_cb(int which)
 {
 	pid_t pid;
+	int save_errno = errno;
 	int status;
 
 	/* Collect dead children. */
 	while ((pid = waitpid(-1, &status, WNOHANG)) > 0 ||
 	    (pid < 0 && errno == EINTR))
 		;
+
+	errno = save_errno;
 }
 
 __dead void