Whamcloud - gitweb
e2fsprogs: Don't try to close an fd which is negative
authorEric Sandeen <sandeen@redhat.com>
Fri, 16 Sep 2011 20:49:38 +0000 (15:49 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 16 Sep 2011 23:55:55 +0000 (19:55 -0400)
commitfe65f1ecfc501b2470a20cfd9d07f4c9efa520d2
treebc0a37e37c9447697dd4f516f55e042dc5d538cd
parentc3ecabe61d075efa1b3f451964f85f3157307f8d
e2fsprogs: Don't try to close an fd which is negative

These reflect either file descriptors which aren't tested
for failure, or closures of fd's which may have failed.

In setup_tdb(), test for failure of mkstemp and return
without trying to open the file (again).

In reserve_stdio_fds, rather than closing the "extra"
fd == 3 due to the way the loop is written, just
don't go that far by using while (fd <= 2).

In logsave, it forks and retries forever if open fails,
but at least make coverity happy by explicitly not
trying to close a negative file descriptor.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/dirinfo.c
e2fsck/unix.c
misc/logsave.c