#include <errno.h>
#include <stdio.h>
+#include <stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
+#include "command-line.h"
#include "daemon.h"
#include "util.h"
int
main(int argc, char *argv[])
{
+ proctitle_init(argc, argv);
set_program_name(argv[0]);
time_init();
} else if (!strcmp(argv[1], "daemon")) {
/* Test that time still advances even in a daemon. This is an
* interesting test because fork() cancels the interval timer. */
- char cwd[1024];
+ char cwd[1024], *pidfile;
FILE *success;
assert(getcwd(cwd, sizeof cwd) == cwd);
/* Daemonize, with a pidfile in the current directory. */
set_detach();
- set_pidfile(xasprintf("%s/test-timeval.pid", cwd));
+ pidfile = xasprintf("%s/test-timeval.pid", cwd);
+ set_pidfile(pidfile);
+ free(pidfile);
set_no_chdir();
daemonize();