[syslog-ng]program destination on OpenBSD

Balazs Scheidler syslog-ng@lists.balabit.hu
Thu, 18 Nov 2004 11:01:00 +0100


hi,

I was reported a reload with program() destinations on OpenBSD. As it 
seems the OpenBSD shell kills the whole process group it is part of when
the shell receives a SIGTERM. As it currently stands syslog-ng is
part of the shell's process group, which means that syslog-ng will be
terminated upon the receipt of a SIGHUP:

1) syslog-ng gets a SIGHUP, 
2) it terminates all its children (which includes a /bin/sh -c)
3) the OpenBSD shell issues kill -TERM 0, which sends a TERM signal to
syslog-ng

This patch should fix the issue, and will be included in tomorrow's
snapshot:

diff -u syslog-ng/src/afprogram.c:1.7.4.1 syslog-ng/src/afprogram.c:1.7.4.2
--- syslog-ng/src/afprogram.c:1.7.4.1   Mon Mar 22 12:56:33 2004
+++ syslog-ng/src/afprogram.c   Thu Nov 18 10:57:27 2004
@@ -109,6 +109,7 @@
                dup2(fd, 2);
                close(fd);
                close(msgpipe[1]);
+               setsid();
                execl("/bin/sh", "/bin/sh", "-c", self->progname->data, NULL);
                _exit(127);
        }

-- 
Bazsi