diff options
author | lioux <lioux@FreeBSD.org> | 2002-11-19 10:12:55 +0800 |
---|---|---|
committer | lioux <lioux@FreeBSD.org> | 2002-11-19 10:12:55 +0800 |
commit | 2e8218e71d773f6762885b49c85d8199d8c2abb1 (patch) | |
tree | 0bd1cdb66dfd1e77dfa51a45b107d51c693f26be /net-p2p/dctc-gui/files | |
parent | f9f382538c57eaf78ade3a7f9eb074ef795149c3 (diff) | |
download | freebsd-ports-gnome-2e8218e71d773f6762885b49c85d8199d8c2abb1.tar.gz freebsd-ports-gnome-2e8218e71d773f6762885b49c85d8199d8c2abb1.tar.zst freebsd-ports-gnome-2e8218e71d773f6762885b49c85d8199d8c2abb1.zip |
Add SIGCHLD signal(3) handling to prevent zombie processes
Diffstat (limited to 'net-p2p/dctc-gui/files')
-rw-r--r-- | net-p2p/dctc-gui/files/patch-src::main.c | 36 | ||||
-rw-r--r-- | net-p2p/dctc-gui/files/sig_chld.c | 53 |
2 files changed, 89 insertions, 0 deletions
diff --git a/net-p2p/dctc-gui/files/patch-src::main.c b/net-p2p/dctc-gui/files/patch-src::main.c new file mode 100644 index 000000000000..f530ccac3963 --- /dev/null +++ b/net-p2p/dctc-gui/files/patch-src::main.c @@ -0,0 +1,36 @@ +--- src/main.c.orig Mon Nov 18 23:53:50 2002 ++++ src/main.c Mon Nov 18 23:55:01 2002 +@@ -43,6 +43,9 @@ + GtkWidget *done_popup=NULL; + GtkWidget *fav_popup=NULL; + ++/* sigchld handling */ ++extern void sig_chld(int); ++ + /* this string is "$HOME/.dctc" */ + GString *dctc_main_dir=NULL; + +@@ -289,11 +292,9 @@ + sigset_t set; + + /* ignore SIGPIPE */ +- /* ignore SIGCHLD */ + /* ignore SIGHUP */ + sigemptyset(&set); + sigaddset(&set,SIGPIPE); +- sigaddset(&set,SIGCHLD); + sigaddset(&set,SIGHUP); + act.sa_handler=SIG_IGN; + act.sa_mask=set; +@@ -301,8 +302,10 @@ + + sigprocmask(SIG_UNBLOCK,&set,NULL); + sigaction(SIGPIPE,&act,NULL); +- sigaction(SIGCHLD,&act,NULL); + sigaction(SIGHUP,&act,NULL); ++ ++ /* handle SIGCHLD */ ++ signal(SIGCHLD, sig_chld); /* Prevents zombies */ + } + + static void start_dctc_client_from_huburl(char *dchub_url,char *profile) diff --git a/net-p2p/dctc-gui/files/sig_chld.c b/net-p2p/dctc-gui/files/sig_chld.c new file mode 100644 index 000000000000..74b4a4afc53a --- /dev/null +++ b/net-p2p/dctc-gui/files/sig_chld.c @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2000, 2001, 2002 + * Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD + */ + +#include <sys/types.h> +#include <sys/wait.h> +/* +#include <sys/time.h> +#include <sys/resource.h> +*/ + +/* + * SIGCHLD handler + * + * Let's take care of our children. + * Otherwise, they may get involved with bad ppl + * and become zombies. + */ +void +sig_chld(int signo) +{ + pid_t pid; + int stat; + + while ( (pid = waitpid(-1, &stat, WNOHANG)) > 0); + + return; +} |