[PATCH] tmpwm fix: SIG_IGN -> SIG_DFL

[email protected] (Jérémie Courrèges -Anglas)
Newsgroups gmane.comp.window-managers.ratpoison.devel
Message-ID <[email protected]>
Hi ratpoison lovers,

here attached is a patch to fix the behaviour of tmpwm on OpenBSD and
probably other OSes where semantics of signal(SIGCHLD, SIG_IGN) are
different from GNU/Linux.  Quoting the OpenBSD signal(3) manpage:

     If the func is set to SIG_IGN for the SIGCHLD signal, the system will not
     create zombie processes when children of the calling process exit.  If
     the calling process subsequently issues a wait(2) (or equivalent), it
     blocks until all of the calling process's child processes terminate, and
     then returns a value of -1 with errno set to ECHILD.  This differs from
     historical BSD behavior but is consistent with AT&T System V UNIX as well
     as the X/Open Portability Guide Issue 4, Version 2 (``XPG4.2'').

I see no reason for this patch to introduce a regression on other
platforms, and testing on Debian Squeeze show no difference in
behaviour.

BTW, the random bug related to tmpwm doesn't seem to be fixed.  Since
I couldn't reproduce it with anything but ''newwm ratpoison'', I'd say
that's not a really big problem. :)

-- 
Jérémie Courrèges-Anglas
GPG Key fingerprint: 61DB D9A0 00A4 67CF 2A90  8961 6191 8FBF 06A1 1494

_______________________________________________
Ratpoison-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/ratpoison-devel
0001-tmpwm-fix-SIG_IGN-SIG_DFL.patch (text/x-patch, 945 B)
From 343b19f653a7f8455e8d1aea7594e5b660e3c2ac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Courr=C3=A8ges-Anglas?= <[email protected]>
Date: Thu, 13 Dec 2012 14:27:54 +0100
Subject: [PATCH] tmpwm fix: SIG_IGN -> SIG_DFL

for signal(SIGCHLD, SIG_IGN) behaves wildly differently across OSes. Fixes
tmpwm hanging after child wm exits on OpenBSD.
---
 src/actions.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/actions.c b/src/actions.c
index bf381c8..8559585 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -4758,7 +4758,7 @@ cmd_tmpwm (int interactive UNUSED, struct cmdarg **args)
   XSync (dpy, False);
 
   /* Disable our SIGCHLD handler */
-  set_sig_handler (SIGCHLD, SIG_IGN);
+  set_sig_handler (SIGCHLD, SIG_DFL);
   /* Launch the new WM and wait for it to terminate. */
   pid = spawn (ARG_STRING(0), 0, NULL);
   PRINT_DEBUG (("spawn pid: %d\n", pid));
-- 
1.8.0.1
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (OpenBSD)

iQIcBAEBCgAGBQJQy7xxAAoJEGGRj78GoRSUUJoP/0rC2E/LAjCFZfa+D52wkZ8s
x3ssuoxKzSd6xQJsiKbxdFKZ684E0tNHMjxP1ntXh801X3HHeRTbxII5rvY+pNIV
DGzqOnyQy5d5E/gqP1BwCBoXzwLsbaOI/kdg2ahMdcK5u36bEjDy/sXA1lpwuyMx
jKcOgNNx4n1lMPfsmHKY1RXisEPKxmVYq7lbjS8Q1D/DB+MeNj+2vcxDKG+BmxZJ
RTMD31wflJyAG+6Eq3xrym0NsCAatcV9tlXoPC5uAHJpSZ2hrq7XaUEesRbG6RNm
Dg//SmAwTXZWgKyKI+z7zs+T5qhFjBM2vCyx50kJrtdYZdAWpTpptLp0QWXitP+1
QsZCUA/fyq2MrG0v2VmOPdiMv0ar493/mGW1rvTlcvLo8tFdnzrhup8zfkd0VFHT
iT+aXPC+yo9JYhQOHUUNwbpppDmZnYjL8wIFhcspDYiFSOZetr96eDLj2nhq1a7+
O++YTcZA92Xq++NMGCwQdBE9bjj8MJlbK9O5juObtTICqFZByJcil6rMBy3qU8FN
iyx61ZMYonzbcasbsiHAx4fU7OhN0+yT07gnedZmxVYFnrgv9AYSgcXYNwTEfzu3
3x40FduNYdtfiWxyncNlKZmzJ3ey5RP5/ehbBZiVnlBRcxCkOxDzaE+HPvVJ4gVt
68JSz+uQp7HqeC6qgSGS
=2i9Y
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.