On Mon, 2006-02-27 at 17:33 -0600, Paul Krizak wrote:
I just downloaded 1.9.9 and I'm getting a segfault for the following syslog-ng.conf:
source s_external_syslog { udp(port(514)); };
destination d_re_mce_aggregator { program( "/bin/true" ); };
log { source(s_external_syslog); destination(d_re_mce_aggregator); };
The patch below should fix this (available in tomorrow's snapshot as well). It actually fixes another bug that prevents syslog-ng noticing exited programs (in order to restart them), but please notice that the configuration above will generate a lot of program executions as /bin/true will immediately exit without processing messages at all. --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,25 @@ # arch-tag: automatic-ChangeLog--devel@balabit.hu--other-1/syslog-ng--mainline--2.0 # +2006-02-28 18:47:01 GMT Balazs Scheidler <bazsi@balabit.hu> patch-20 + + Summary: + fixed possible abort in program destination + Revision: + syslog-ng--mainline--2.0--patch-20 + + * src/afprog.c (afprogram_dd_deinit): don't drop the reference to + self->writer, only deinit it, + (afprogram_dd_free): drop the reference to self->writer, + + * src/main.c (main_loop_run): change the loop so that it actually + processes exited children + + + modified files: + ChangeLog src/afprog.c src/main.c + + 2006-02-26 09:39:39 GMT Balazs Scheidler <bazsi@balabit.hu> patch-19 Summary: --- orig/src/afprog.c +++ mod/src/afprog.c @@ -141,10 +141,7 @@ afprogram_dd_deinit(LogPipe *s, GlobalCo self->pid = -1; } if (self->writer) - { - log_pipe_deinit(self->writer, NULL, NULL); - log_pipe_unref(self->writer); - } + log_pipe_deinit(self->writer, NULL, NULL); return TRUE; } @@ -153,7 +150,7 @@ afprogram_dd_free(LogPipe *s) { AFProgramDestDriver *self = (AFProgramDestDriver *) s; - g_assert(!self->writer); + log_pipe_unref(self->writer); g_string_free(self->cmdline, TRUE); log_drv_free_instance(&self->super); g_free(self); --- orig/src/main.c +++ mod/src/main.c @@ -172,14 +172,15 @@ main_loop_run(GlobalConfig *cfg) } if (sig_child_received) { - pid_t pid = 0; + pid_t pid; int status; - while (pid > 0) + do { pid = waitpid(-1, &status, WNOHANG); child_manager_sigchild(pid, status); } + while (pid > 0); sig_child_received = FALSE; } } -- Bazsi