Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2013-03-25 13:12:51 UTC (rev 231)
+++ trunk/Makefile 2013-03-25 13:23:58 UTC (rev 232)
@@ -615,6 +615,7 @@
cd ${NAGIOS} && patch -p1 < ../patches/nagios_allow_unescaped_semi_colons_for_check_commands_in_config_file.patch
cd ${NAGIOS} && patch -p1 < ../patches/nagios_bugfix_2637_to_2640.patch
cd ${NAGIOS} && patch -p0 < ../patches/nagios_tilda_in_commands_execute_via_shell.patch
+ cd ${NAGIOS} && patch -p0 < ../patches/nagios_bugfix_2650_2651.patch
if [ $(KERNEL_NAME) = Linux ] ; then \
cd ${NAGIOS} && CFLAGS="${CFLAGS}" ./configure --with-nagios-user=$(NAGIOS_USER) --with-nagios-group=$(NAGIOS_GROUP) --with-command-group=$(NAGIOS_GROUP) --with-cgiurl=/cgi-bin --with-htmurl=/ --enable-libtap ; \
elif [ $(KERNEL_NAME) = Darwin ] ; then \
Added: trunk/patches/nagios_bugfix_2650_2651.patch
===================================================================
--- trunk/patches/nagios_bugfix_2650_2651.patch (rev 0)
+++ trunk/patches/nagios_bugfix_2650_2651.patch 2013-03-25 13:23:58 UTC (rev 232)
@@ -0,0 +1,91 @@
+Index: lib/wproc.c
+===================================================================
+--- lib/wproc.c (revision 2649)
++++ lib/wproc.c (revision 2651)
+@@ -30,7 +30,7 @@
+ static void sighandler(int sig)
+ {
+ sigreceived = sig;
+- printf("%d: caught sig %d (%s)\n", getpid(), sig, strsignal(sig));
++ printf("%d: caught sig %d\n", getpid(), sig);
+ }
+
+ static void child_exited(int sig)
+Index: lib/worker.c
+===================================================================
+--- lib/worker.c (revision 2649)
++++ lib/worker.c (revision 2651)
+@@ -209,12 +209,25 @@
+ kvvec_addkv_wlen(kvv, key, sizeof(key) - 1, buf, strlen(buf)); \
+ } while (0)
+
++/* forward declaration */
++static void gather_output(child_process *cp, iobuf *io, int final);
++
+ int finish_job(child_process *cp, int reason)
+ {
+ static struct kvvec resp = KVVEC_INITIALIZER;
+ struct rusage *ru = &cp->ei->rusage;
+ int i, ret;
+
++ /* get rid of still open filedescriptors */
++ if (cp->outstd.fd != -1) {
++ gather_output(cp, &cp->outstd, 1);
++ iobroker_close(iobs, cp->outstd.fd);
++ }
++ if (cp->outerr.fd != -1) {
++ gather_output(cp, &cp->outerr, 1);
++ iobroker_close(iobs, cp->outerr.fd);
++ }
++
+ /* how many key/value pairs do we need? */
+ if (kvvec_init(&resp, 12 + cp->request->kv_pairs) == NULL) {
+ /* what the hell do we do now? */
+@@ -238,12 +251,6 @@
+ squeue_remove(sq, cp->ei->sq_event);
+ running_jobs--;
+
+- /* get rid of still open filedescriptors */
+- if (cp->outstd.fd != -1)
+- iobroker_close(iobs, cp->outstd.fd);
+- if (cp->outerr.fd != -1)
+- iobroker_close(iobs, cp->outerr.fd);
+-
+ cp->ei->runtime = tv_delta_f(&cp->ei->start, &cp->ei->stop);
+
+ /*
+@@ -385,7 +392,7 @@
+ #endif /* PLAY_NICE_IN_kill_job */
+ }
+
+-static void gather_output(child_process *cp, iobuf *io)
++static void gather_output(child_process *cp, iobuf *io, int final)
+ {
+ iobuf *other_io;
+
+@@ -409,7 +416,7 @@
+ memcpy(&io->buf[io->len], buf, rd);
+ io->len += rd;
+ io->buf[io->len] = '\0';
+- } else {
++ } else if (!final) {
+ iobroker_close(iobs, io->fd);
+ io->fd = -1;
+ if (other_io->fd < 0) {
+@@ -426,14 +433,14 @@
+ static int stderr_handler(int fd, int events, void *cp_)
+ {
+ child_process *cp = (child_process *)cp_;
+- gather_output(cp, &cp->outerr);
++ gather_output(cp, &cp->outerr, 0);
+ return 0;
+ }
+
+ static int stdout_handler(int fd, int events, void *cp_)
+ {
+ child_process *cp = (child_process *)cp_;
+- gather_output(cp, &cp->outstd);
++ gather_output(cp, &cp->outstd, 0);
+ return 0;
+ }
+