Skip to content

Commit

Permalink
catch daemon() errors
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed May 30, 2024
1 parent f74b32c commit 3a0a22f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/hdapsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,10 @@ int main (int argc, char** argv)
return 1;
}
}
daemon(0,0);
if (daemon(0,0) != 0) {
printlog (stderr, "Failed to daemonize");
return 1;
}
if (pidfile) {
char buf[BUF_LEN];
snprintf (buf, sizeof(buf), "%d\n", getpid());
Expand Down

0 comments on commit 3a0a22f

Please sign in to comment.