Skip to content

Commit

Permalink
btrfs-progs: prop: allow autodetect_object_types() to handle link
Browse files Browse the repository at this point in the history
The function autodetect_object_types() tries to detect the type of
btrfs object passed. If it is an "inode" type (e.g. file) this function
returns the type as "inode". If it is a block device, it return it as
"block device".
However it doesn't handle the case where the object passed is a link
to a block device (which could be a valid btrfs device). For example
LVM/DM creates link to block devices. In this case it should return
the type as "block device".

This patch replace the lstat() call with a stat().

Reported-by: Boris Burkov <boris@bur.io>
Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
kreijack authored and kdave committed Jan 10, 2022
1 parent 79ef78f commit 8174832
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmds/property.c
Expand Up @@ -373,7 +373,7 @@ static int autodetect_object_types(const char *object, int *types_out)

is_btrfs_object = check_btrfs_object(object);

ret = lstat(object, &st);
ret = stat(object, &st);
if (ret < 0) {
ret = -errno;
goto out;
Expand Down

0 comments on commit 8174832

Please sign in to comment.