fix check for return value of open when redirecting to null device

This commit is contained in:
Gilles Depeyrot
2021-07-16 09:34:57 +08:00
committed by Max Lv
parent 4bbbe212eb
commit 8bcffa54b5
+1 -1
View File
@@ -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);