X-Git-Url: http://git.onelab.eu/?p=distributedratelimiting.git;a=blobdiff_plain;f=ulogd.c;h=4553d4dd96f17c3f7e53046a953237df12ab614b;hp=9b998a94453d46979b94e65e158e8032bb60a6a1;hb=3cc87c8471668009b3426013fded8c6ec5a382da;hpb=7df21963a496196ca1d5b874876ddad5472245b2 diff --git a/ulogd.c b/ulogd.c index 9b998a9..4553d4d 100644 --- a/ulogd.c +++ b/ulogd.c @@ -769,6 +769,17 @@ int main(int argc, char* argv[]) } } + if (daemonize){ + if (fork()) { + exit(0); + } + if (logfile != stdout) + fclose(stdout); + fclose(stderr); + fclose(stdin); + setsid(); + } + logfile_open(logf_ce.u.string); for (p = ulogd_outputs; p; p = p->next) { @@ -781,16 +792,6 @@ int main(int argc, char* argv[]) interh_dump(); keyh_dump(); #endif - if (daemonize){ - if (fork()) { - exit(0); - } - if (logfile != stdout) - fclose(stdout); - fclose(stderr); - fclose(stdin); - setsid(); - } /* send SIGINT to the term handler, since they hit CTRL-C */ signal(SIGINT, &sigterm_handler);