* Simplify daemonize ifdefs.

This commit is contained in:
Justin Maggard
2011-09-03 01:32:56 +00:00
parent ef37d2e993
commit 4857493e4f
3 changed files with 11 additions and 16 deletions

View File

@@ -41,12 +41,12 @@
#include "config.h"
#include "log.h"
#ifndef USE_DAEMON
int
daemonize(void)
{
int pid, i;
int pid;
#ifndef USE_DAEMON
int i;
switch(fork())
{
@@ -72,16 +72,20 @@ daemonize(void)
dup(i); /* stderr */
umask(027);
chdir("/"); /* chdir to /tmp ? */
return pid;
chdir("/");
break;
/* parent process */
default:
exit(0);
}
}
#else
if( daemon(0, 0) < 0 )
perror("daemon()");
pid = getpid();
#endif
return pid;
}
int
writepidfile(const char * fname, int pid)