Tune pidfile error

This commit is contained in:
Ron Pedde 2005-01-07 05:57:52 +00:00
parent dd3bc4c731
commit c681c03af1
1 changed files with 2 additions and 2 deletions

View File

@ -796,14 +796,14 @@ int main(int argc, char *argv[]) {
/* open the pidfile, so it can be written once we detach */
if(!foreground) {
daemon_start();
if(-1 == (pid_fd = open(PIDFILE,O_CREAT | O_WRONLY | O_TRUNC, 0644)))
DPRINTF(E_FATAL,L_MAIN,"Error opening pidfile (%s): %s\n",PIDFILE,strerror(errno));
if(0 == (pid_fp = fdopen(pid_fd, "w")))
DPRINTF(E_FATAL,L_MAIN,"fdopen: %s\n",strerror(errno));
daemon_start();
fprintf(pid_fp,"%d\n",getpid());
fclose(pid_fp);
}