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>
This commit is contained in:
Qu Wenruo 2024-02-02 11:29:20 +10:30 committed by David Sterba
parent da1d497a16
commit ace7d241cc

View File

@ -535,6 +535,7 @@ out:
}
close_ctree(root);
btrfs_close_all_devices();
close(fd);
free_out:
return ret;