summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Crane <arc@aaroncrane.co.uk>2014-08-03 21:52:11 -0400
committerTheodore Ts'o <tytso@mit.edu>2014-08-04 18:58:23 -0400
commit3b0662fc95e4fefb489ba332d417f0733eb37f44 (patch)
tree255ac7ad8fdb3ca8e476628153c037f43f5f1b04
parent09727a0705b963db727086ce8d9a7fa9edd266c1 (diff)
downloade2fsprogs-3b0662fc95e4fefb489ba332d417f0733eb37f44.tar.gz
debugfs: fix double-close bug in "rdump" and "dump -p"
Previously, both of these usages called dump_file() with a true value as the "preserve" argument, which caused it to in turn call fix_perms() to make the permissions on the locally-dumped file match those found on the ext2 filesystem. fix_perms() then attempted to close(2) the file descriptor (if any) before returning (though it didn't attempt to report on any errors found while doing so). However, in both of these situations, the local file being dumped had been opened by the caller of dump_file(), which also closes it (and reports on any errors detected when closing). This meant that both "rdump" and "dump -p" would then emit a spurious EBADF message when trying to re-close the local file descriptor. Deleting the spurious close(2) call in fix_perms() fixes the problem in both commands. Signed-off-by: Aaron Crane <arc@aaroncrane.co.uk> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--debugfs/dump.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/debugfs/dump.c b/debugfs/dump.c
index f4f1625f..13bf06af 100644
--- a/debugfs/dump.c
+++ b/debugfs/dump.c
@@ -91,9 +91,6 @@ static void fix_perms(const char *cmd, const struct ext2_inode *inode,
if (i == -1)
com_err(cmd, errno, "while changing ownership of %s", name);
- if (fd != -1)
- close(fd);
-
ut.actime = inode->i_atime;
ut.modtime = inode->i_mtime;
if (utime(name, &ut) == -1)