Change tabs to whitespaces
This commit is contained in:
@@ -22,26 +22,26 @@ static bool writePid(int32_t pid, char *fileName) {
|
||||
}
|
||||
|
||||
void startDaemon(struct opt_struct* opts) {
|
||||
if(!opts->daemon) {
|
||||
// No backgrounding, optionslly write current PID
|
||||
if(opts->pidFileName != NULL) {
|
||||
writePid(getpid(), opts->pidFileName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
int32_t pid = fork();
|
||||
if(pid < 0) {
|
||||
fputs("fork() failed\n", stderr);
|
||||
exit(1);
|
||||
} else if(pid > 0) {
|
||||
// Parent
|
||||
if(opts->pidFileName != NULL) {
|
||||
if(!writePid(pid, opts->pidFileName)) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
// Child
|
||||
if(!opts->daemon) {
|
||||
// No backgrounding, optionslly write current PID
|
||||
if(opts->pidFileName != NULL) {
|
||||
writePid(getpid(), opts->pidFileName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
int32_t pid = fork();
|
||||
if(pid < 0) {
|
||||
fputs("fork() failed\n", stderr);
|
||||
exit(1);
|
||||
} else if(pid > 0) {
|
||||
// Parent
|
||||
if(opts->pidFileName != NULL) {
|
||||
if(!writePid(pid, opts->pidFileName)) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
// Child
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user