aboutsummaryrefslogtreecommitdiffstats
path: root/calmwm.c
diff options
context:
space:
mode:
authortobias2008-05-06 15:12:04 +0000
committertobias2008-05-06 15:12:04 +0000
commit54eb3329681d8fa7c5bbd5e7eb871421cf6e5a2b (patch)
tree39f6a843716d3e3e3dbf6d17aea654630a8f4050 /calmwm.c
parent9b75e9613b34b47c145de16e7d8fea99149b9838 (diff)
downloadcwm-54eb3329681d8fa7c5bbd5e7eb871421cf6e5a2b.tar.gz
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 '')
-rw-r--r--calmwm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/calmwm.c b/calmwm.c
index 84bff28..d4e20ef 100644
--- a/calmwm.c
+++ b/calmwm.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: calmwm.c,v 1.16 2008/04/15 20:24:41 oga Exp $
+ * $Id: calmwm.c,v 1.17 2008/05/06 15:12:04 tobias Exp $
*/
#include "headers.h"
@@ -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