From: octo Date: Fri, 16 Dec 2005 12:36:34 +0000 (+0000) Subject: Changed collectd.c so the `-P pidfile' option has an effect X-Git-Tag: collectd-3.5.0~4 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=8489fabfd730c048884b31c5785ebf1a33a29354;p=collectd.git Changed collectd.c so the `-P pidfile' option has an effect --- diff --git a/src/collectd.c b/src/collectd.c index 2f05b93f..418a5d74 100644 --- a/src/collectd.c +++ b/src/collectd.c @@ -216,13 +216,16 @@ int start_server (void) } #endif /* HAVE_LIBRRD */ -int pidfile_create (void) +int pidfile_create (char *file) { FILE *fh; - if ((fh = fopen (PIDFILE, "w")) == NULL) + if (file == NULL) + file = PIDFILE; + + if ((fh = fopen (file, "w")) == NULL) { - syslog (LOG_ERR, "fopen (pidfile): %s", strerror (errno)); + syslog (LOG_ERR, "fopen (%s): %s", file, strerror (errno)); return (1); } @@ -368,7 +371,7 @@ int main (int argc, char **argv) setsid (); /* Write pidfile */ - if (pidfile_create ()) + if (pidfile_create (pidfile)) exit (2); /* close standard descriptors */