mirror of
https://github.com/owntone/owntone-server.git
synced 2025-07-26 17:00:13 -04:00
Tune pidfile error
This commit is contained in:
parent
dd3bc4c731
commit
c681c03af1
@ -796,14 +796,14 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
/* open the pidfile, so it can be written once we detach */
|
/* open the pidfile, so it can be written once we detach */
|
||||||
if(!foreground) {
|
if(!foreground) {
|
||||||
daemon_start();
|
|
||||||
|
|
||||||
if(-1 == (pid_fd = open(PIDFILE,O_CREAT | O_WRONLY | O_TRUNC, 0644)))
|
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));
|
DPRINTF(E_FATAL,L_MAIN,"Error opening pidfile (%s): %s\n",PIDFILE,strerror(errno));
|
||||||
|
|
||||||
if(0 == (pid_fp = fdopen(pid_fd, "w")))
|
if(0 == (pid_fp = fdopen(pid_fd, "w")))
|
||||||
DPRINTF(E_FATAL,L_MAIN,"fdopen: %s\n",strerror(errno));
|
DPRINTF(E_FATAL,L_MAIN,"fdopen: %s\n",strerror(errno));
|
||||||
|
|
||||||
|
daemon_start();
|
||||||
|
|
||||||
fprintf(pid_fp,"%d\n",getpid());
|
fprintf(pid_fp,"%d\n",getpid());
|
||||||
fclose(pid_fp);
|
fclose(pid_fp);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user