aboutsummaryrefslogtreecommitdiff
path: root/net-p2p
diff options
context:
space:
mode:
authorMario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>2002-11-19 02:12:55 +0000
committerMario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>2002-11-19 02:12:55 +0000
commitbdaf558d2d6efd6767641eea81fa4a1a688d41a2 (patch)
treefc5ea325083a2771ae60ceac4aa3148e31cb8faa /net-p2p
parenta59bb3d05b881856f251eddf14de0af5e57b51c7 (diff)
downloadports-bdaf558d2d6efd6767641eea81fa4a1a688d41a2.tar.gz
ports-bdaf558d2d6efd6767641eea81fa4a1a688d41a2.zip
Add SIGCHLD signal(3) handling to prevent zombie processes
Notes
Notes: svn path=/head/; revision=70449
Diffstat (limited to 'net-p2p')
-rw-r--r--net-p2p/dctc-gui/Makefile15
-rw-r--r--net-p2p/dctc-gui/files/patch-src::main.c36
-rw-r--r--net-p2p/dctc-gui/files/sig_chld.c53
3 files changed, 104 insertions, 0 deletions
diff --git a/net-p2p/dctc-gui/Makefile b/net-p2p/dctc-gui/Makefile
index fbb5de01571c..3a1e37304858 100644
--- a/net-p2p/dctc-gui/Makefile
+++ b/net-p2p/dctc-gui/Makefile
@@ -7,6 +7,7 @@
PORTNAME= dctc
PORTVERSION= 0.65
+PORTREVISION= 1
CATEGORIES= net gnome
MASTER_SITES= http://unixpages.org/distfiles/ \
http://ac2i.tzo.com/dctc/
@@ -31,8 +32,15 @@ CONFIGURE_ARGS= --with-gnome=${X11BASE} \
--enable-manual-db-detect \
--with-libiconv-prefix=${LOCALBASE}
+ADDITIONAL_SRCS= sig_chld.c
+#
DOC_FILES= COPYING ChangeLog README TODO
+post-extract:
+.for file in ${ADDITIONAL_SRCS}
+ @${CP} ${FILESDIR}/${file} ${WRKSRC}/src
+.endfor
+
post-patch:
@${FIND} ${WRKSRC} -type f | ${XARGS} -n 10 -x ${REINPLACE_CMD} -E -e \
's|ldb-4.0|ldb4|; \
@@ -52,6 +60,13 @@ post-patch:
@${FIND} ${WRKSRC} -type f \
-name "*.bak" \
| ${XARGS} -n 10 -x ${RM}
+# add sigchld handler
+.for file in ${ADDITIONAL_SRCS}
+ @${REINPLACE_CMD} -E -e \
+ 's|^(dc_gui_SOURCES.+)$$|\1 ${file}|; \
+ s|^(dc_gui_OBJECTS[^\\]+)(\\*)$$|\1 ${file:S/.c$/.o/} \2|' \
+ ${WRKSRC}/src/Makefile.in
+.endfor
post-configure:
@${ECHO_CMD} '#ifndef MSG_NOSIGNAL' >> ${CONFIGURE_WRKSRC}/config.h
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;
+}