diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | mbinputmgr.c | 18 |
2 files changed, 23 insertions, 0 deletions
@@ -1,3 +1,8 @@ +2005-10-17 Matthew Allum <mallum@openedhand.com> + + * mbinputmgr.c: (selected_method_load), (mbinpmgr_init): + Deal with Zombies. + 2005-05-23 mallum,,, <mallum@openedhand.com> * mbinputmgr-tray.c: (button_callback), (xevent_callback): diff --git a/mbinputmgr.c b/mbinputmgr.c index 12a84ea..be98469 100644 --- a/mbinputmgr.c +++ b/mbinputmgr.c @@ -1,5 +1,21 @@ #include "mbinputmgr.h" +void +cleanup_children(int s) +{ + kill(-getpid(), 15); /* kill every one in our process group */ + exit(0); +} + +void +install_signal_handlers(void) +{ + signal (SIGCHLD, SIG_IGN); /* kernel can deal with zombies */ + signal (SIGINT, cleanup_children); + signal (SIGQUIT, cleanup_children); + signal (SIGTERM, cleanup_children); +} + static void fork_exec(MBInpmgrState *inpmgr, char *cmd) { @@ -98,6 +114,8 @@ mbinpmgr_init(void) char orig_wd[256]; int i; + install_signal_handlers(); + inpmgr = malloc(sizeof(MBInpmgrState)); memset(inpmgr,0,sizeof(MBInpmgrState)); |