X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fdaemon%2Fcollectd.c;h=46e13b3f31256dd32e9accc1c54e2b1a47bd4426;hp=9cba9132814cbcafa97ddf92f6289c5bd9c0991d;hb=0003c4d3c184f0f437499d6073cd023dc7b659c2;hpb=2421812ea47269c50920414a6e3c32448800120f diff --git a/src/daemon/collectd.c b/src/daemon/collectd.c index 9cba9132..46e13b3f 100644 --- a/src/daemon/collectd.c +++ b/src/daemon/collectd.c @@ -270,7 +270,7 @@ static void update_kstat (void) */ static void exit_usage (int status) { - printf ("Usage: "PACKAGE" [OPTIONS]\n\n" + printf ("Usage: "PACKAGE_NAME" [OPTIONS]\n\n" "Available options:\n" " General:\n" @@ -289,7 +289,7 @@ static void exit_usage (int status) " PID file "PIDFILE"\n" " Plugin directory "PLUGINDIR"\n" " Data directory "PKGLOCALSTATEDIR"\n" - "\n"PACKAGE" "VERSION", http://collectd.org/\n" + "\n"PACKAGE_NAME" "PACKAGE_VERSION", http://collectd.org/\n" "by Florian octo Forster \n" "for contributions see `AUTHORS'\n"); exit (status); @@ -309,7 +309,7 @@ static int do_init (void) #if HAVE_LIBSTATGRAB if (sg_init ( -# if HAVE_LIBSTATGRAB_INIT_ARG +# if HAVE_LIBSTATGRAB_0_90 0 # endif )) @@ -408,12 +408,14 @@ static int pidfile_create (void) static int pidfile_remove (void) { const char *file = global_option_get ("PIDFile"); + if (file == NULL) + return 0; - DEBUG ("unlink (%s)", (file != NULL) ? file : ""); return (unlink (file)); } /* static int pidfile_remove (const char *file) */ #endif /* COLLECT_DAEMON */ +#ifdef KERNEL_LINUX int notify_upstart (void) { const char *upstart_job = getenv("UPSTART_JOB"); @@ -479,6 +481,7 @@ int notify_systemd (void) close(fd); return 1; } +#endif /* KERNEL_LINUX */ int main (int argc, char **argv) { @@ -598,9 +601,13 @@ int main (int argc, char **argv) /* * Only daemonize if we're not being supervised - * by upstart or systemd. + * by upstart or systemd (when using Linux). */ - if (daemonize && notify_upstart() == 0 && notify_systemd() == 0) + if (daemonize +#ifdef KERNEL_LINUX + && notify_upstart() == 0 && notify_systemd() == 0 +#endif + ) { if ((pid = fork ()) == -1) {