Whamcloud - gitweb
e2fsck: fix fd leak in reserve_stdio_fds
authorTheodore Ts'o <tytso@mit.edu>
Sun, 12 Aug 2018 00:47:08 +0000 (20:47 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 14 Aug 2018 01:32:55 +0000 (21:32 -0400)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
e2fsck/unix.c

index 90065b3..2df22b1 100644 (file)
@@ -617,9 +617,10 @@ static void reserve_stdio_fds(void)
                        fprintf(stderr, _("ERROR: Couldn't open "
                                "/dev/null (%s)\n"),
                                strerror(errno));
-                       break;
+                       return;
                }
        }
+       (void) close(fd);
 }
 
 #ifdef HAVE_SIGNAL_H