]> git.kaiwu.me - haproxy.git/commitdiff
[MINOR] don't close stdio fds twice
authorWilly Tarreau <w@1wt.eu>
Sun, 10 May 2009 08:33:29 +0000 (10:33 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 10 May 2009 16:19:22 +0000 (18:19 +0200)
This minor harmless bug dates back to v1.1. When fclose() was added,
the close() calls were not removed, so the fds 0,1,2 are closed twice.
(cherry picked from commit 1700b9c3d5f06ac283ab2e254bd64b1bc7a207ca)
(cherry picked from commit ac053933b34c4c7d9e25fe75f569b70e394245fa)

src/haproxy.c

index e0c33a2380184e6a1ce911d25956d49dcb854133..a1c3d9dabd3d3bce84a57f83af0df027044330a2 100644 (file)
@@ -901,7 +901,6 @@ int main(int argc, char **argv)
        if ((global.mode & MODE_QUIET) && !(global.mode & MODE_VERBOSE)) {
                /* detach from the tty */
                fclose(stdin); fclose(stdout); fclose(stderr);
-               close(0); close(1); close(2);
        }
 
        /* open log & pid files before the chroot */
@@ -1067,7 +1066,6 @@ int main(int argc, char **argv)
                if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) {
                        /* detach from the tty */
                        fclose(stdin); fclose(stdout); fclose(stderr);
-                       close(0); close(1); close(2); /* close all fd's */
                        global.mode &= ~MODE_VERBOSE;
                        global.mode |= MODE_QUIET; /* ensure that we won't say anything from now */
                }