Skip to content

Commit

Permalink
fix check for return value of open when redirecting to null device
Browse files Browse the repository at this point in the history
  • Loading branch information
gdepeyrot authored and Max Lv committed Jul 16, 2021
1 parent 4bbbe21 commit 8bcffa5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ daemonize(const char *path)
}

int dev_null = open("/dev/null", O_WRONLY);
if (dev_null) {
if (dev_null > 0) {
/* Redirect to null device */
dup2(dev_null, STDOUT_FILENO);
dup2(dev_null, STDERR_FILENO);
Expand Down

0 comments on commit 8bcffa5

Please sign in to comment.