]> granicus.if.org Git - icinga2/commitdiff
Fix file descriptor leak in SetDaemonIO
authorGunnar Beutner <gunnar@beutner.name>
Tue, 3 Mar 2015 06:36:43 +0000 (07:36 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Tue, 3 Mar 2015 06:36:43 +0000 (07:36 +0100)
lib/cli/daemoncommand.cpp

index 503c83a89cc3e95217fa6bf76805779be5230d3f..f82071b5cae3bf352d0a2269b124a1c798200438 100644 (file)
@@ -134,7 +134,7 @@ static bool SetDaemonIO(const String& stderrFile)
        if (fderr < 0 && errno == ENOENT)
                fderr = open(errPath, O_CREAT | O_WRONLY | O_APPEND, 0600);
 
-       if (fderr > 0) {
+       if (fderr >= 0) {
                if (fderr != 2)
                        dup2(fderr, 2);