Search
j0ke.net Open Build Service
>
Projects
>
ha
:
firewall
>
snortsam
> snortsam-write-pid.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File snortsam-write-pid.patch of Package snortsam (Revision 7)
Currently displaying revision
7
,
show latest
--- src/snortsam.h.orig 2013-02-07 20:15:24.148122499 +0100 +++ src/snortsam.h 2013-02-07 20:15:35.716124479 +0100 @@ -69,6 +69,7 @@ #include <errno.h> #include <sys/types.h> +#include <syslog.h> #ifdef WIN32 /* ------------------ Windows platform specific stuff ----------------------- */ --- src/snortsam.c.orig 2013-02-07 20:06:57.420122275 +0100 +++ src/snortsam.c 2013-02-07 20:14:54.288122795 +0100 @@ -2997,6 +2997,20 @@ if(wantdaemon) /* If "daemon" is set in config file... */ { if(daemon(1, 0) != -1) /* ..try to daemonize thyself... */ daemonized=TRUE; /* ...and let us know. */ + pid_t pid; + FILE *pidf; + pid = getpid(); + if (pid > 0) { + pidf = fopen ("/var/run/snortsam/snortsam.pid", "w"); + if (!pidf) { + openlog("snortsam", LOG_PID, LOG_DAEMON); + syslog(LOG_ERR, "Can't write PID %d to /var/run/snortsam/snortsam.pid", (int)pid); + } else { + fprintf(pidf, "%d\n", (int)pid); + fclose(pidf); + } + exit(EXIT_SUCCESS); + } } #endif