From 8489fabfd730c048884b31c5785ebf1a33a29354 Mon Sep 17 00:00:00 2001 From: octo Date: Fri, 16 Dec 2005 12:36:34 +0000 Subject: [PATCH] Changed collectd.c so the `-P pidfile' option has an effect --- src/collectd.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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 */ -- 2.11.0