aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2024-02-02 11:29:20 +1030
committerDavid Sterba <dsterba@suse.com>2024-02-08 08:30:37 +0100
commitace7d241ccf2582e832c4c4a75eb6b638a0f543b (patch)
tree530b569a438653c2d3dbf0b2962bd5f68e185d7a
parentda1d497a164639b36995773fbb70873f1548e2c9 (diff)
downloadbtrfs-progs-ace7d241ccf2582e832c4c4a75eb6b638a0f543b.tar.gz
btrfs-progs: tune: fix the missing close() of filesystem fd
[BUG] In "btrfs tune" subcommand, we're using open_ctree_fd(), which requires passing a valid fd, and the caller is responsible to properly handling the lifespan of the fd. But we just call close_ctree() and btrfs_close_all_devices(), without closing the fd. [FIX] Just manually close the fd. Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--tune/main.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tune/main.c b/tune/main.c
index 9dcb5595..0fbf37dd 100644
--- a/tune/main.c
+++ b/tune/main.c
@@ -535,6 +535,7 @@ out:
}
close_ctree(root);
btrfs_close_all_devices();
+ close(fd);
free_out:
return ret;