while ((dirlen > 0) && (dir[dirlen - 1] == '/'))
dir[--dirlen] = '\0';
- if (dirlen <= 0)
+ if (dirlen <= 0) {
+ free (dir);
return (-1);
+ }
status = chdir (dir);
if (status == 0)
*/
static void exit_usage (int status)
{
- printf ("Usage: "PACKAGE" [OPTIONS]\n\n"
+ printf ("Usage: "PACKAGE_NAME" [OPTIONS]\n\n"
"Available options:\n"
" General:\n"
" 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 <octo@collectd.org>\n"
"for contributions see `AUTHORS'\n");
exit (status);
static int pidfile_remove (void)
{
const char *file = global_option_get ("PIDFile");
+ if (file == NULL)
+ return 0;
- DEBUG ("unlink (%s)", (file != NULL) ? file : "<null>");
return (unlink (file));
} /* static int pidfile_remove (const char *file) */
#endif /* COLLECT_DAEMON */