Change directory only when detaching

This commit is contained in:
Michael Spang 2009-07-31 04:29:07 -04:00
parent 43319f134b
commit 628c9076fe
1 changed files with 2 additions and 2 deletions

View File

@ -68,9 +68,9 @@ static void setup_signals(void) {
}
static void setup_daemon(void) {
if (detach) {
if (chdir("/"))
fatalpe("chdir('/')");
if (detach) {
pid_t pid = fork();
if (pid < 0)
fatalpe("fork");