]> git.ipfire.org Git - thirdparty/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 08:33:29 +0000 (10:33 +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.

src/haproxy.c

index 31c48e1c0584660e7ea9dce37a1fdc1baa7d9cc7..1c4501a1d480a48c1a44be599b07c53a33d002a2 100644 (file)
@@ -980,7 +980,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 */
@@ -1158,7 +1157,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 */
                }