return 1;
c = reply;
- c += snprintf(c, INITIAL_REPLY_LEN, "%s\n", daemon_status());
+ c += snprintf(c, INITIAL_REPLY_LEN, "pid %d %s\n",
+ daemon_pid, daemon_status());
*r = reply;
*len = (int)(c - reply + 1);
int logsink;
enum daemon_status running_state;
+pid_t daemon_pid;
/*
* global copy of vecs for use in sig handlers
pthread_mutex_lock(&exit_mutex);
/* Startup complete, create logfile */
- if (pidfile_create(DEFAULT_PIDFILE, getpid()))
+ if (pidfile_create(DEFAULT_PIDFILE, daemon_pid))
/* Ignore errors, we can live without */
condlog(1, "failed to create pidfile");
else if (pid != 0)
_exit(0);
+ daemon_pid = getpid();
in_fd = open("/dev/null", O_RDONLY);
if (in_fd < 0){
fprintf(stderr, "cannot open /dev/null for input : %s\n",