Clean up printing to PID file and logging of that
This commit is contained in:
parent
67f0ab405a
commit
4f17e0b6d2
|
@ -166,10 +166,7 @@ int pidfile_write(void)
|
|||
return -1; /* come back later */
|
||||
}
|
||||
|
||||
snprintf(buf, sizeof(buf), "%lu\n", (unsigned long)getpid());
|
||||
ret = safe_write_fixed(fd, buf, strlen(buf));
|
||||
|
||||
if((size_t)ret != strlen(buf)) {
|
||||
if(dprintf(fd, "%lu\n", (unsigned long)getpid()) == -1) {
|
||||
LOG(LOG_ERR, "Couldn't write to PID file `%s' (%m).", pidfile_filename);
|
||||
TEMP_FAILURE_RETRY( close(fd) );
|
||||
return -1; /* come back later */
|
||||
|
@ -181,7 +178,7 @@ int pidfile_write(void)
|
|||
}
|
||||
|
||||
/* success -- log, register handler, return */
|
||||
LOG(LOG_NOTICE, "PID %s written to `%s'.", buf, pidfile_filename);
|
||||
LOG(LOG_NOTICE, "Wrote PID %lu to `%s'.", (unsigned long)getpid(), pidfile_filename);
|
||||
atexit(pidfile_unlink);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue