From c681c03af15b61a7776a1e5c4e22726eb983a0e7 Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Fri, 7 Jan 2005 05:57:52 +0000 Subject: [PATCH] Tune pidfile error --- src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index d99bcdfb..f13d7676 100644 --- a/src/main.c +++ b/src/main.c @@ -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); }