btrfs-progs: Fix btrfs fi show by uuid and label
PATCH 1/1 btrfs-progs: Fix btrfs fi show by uuid and label
Commit 8be2fff (btrfs-progs: apply realpath for btrfs fi show when mount point is given) changed the behavior of btrfs fi show to return an error if the call to realpath() failed. This broke the ability to specify a filesystem by uuid or label.
So let's not consider a failed call to realpath() as an error. If the user really specified a bad device, just return nothing like we did before.
--- cmds-filesystem.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
cmds-filesystem.c +2 -7
@@ -901,13 +901,8 @@ static int cmd_show(int argc, char **argv)* realpath do /mnt/btrfs/ => /mnt/btrfs * which shall be recognized by btrfs_scan_kernel() */ -if (!realpath (search, path)) { -fprintf (stderr,"ERROR: Could not show %s: %s\n" , - search,strerror (errno)); -return 1 ; - } - - search = path; +if (realpath (search, path)) + search = path;/* * Needs special handling if input arg is block dev And if
Signature · 1 line
1.7.10.4
Quoted 5 lines · Justin Maggard
Commit 8be2fff (btrfs-progs: apply realpath for btrfs fi show when mount point is given) changed the behavior of btrfs fi show to return an error if the call to
realpath()failed. This broke the ability to specify a filesystem by uuid or label.
Oh, that's my fault, thanks for correcting this.
Quoted 14 lines
So let's not consider a failed call to
realpath()as an error. If the user really specified a bad device, just return nothing like we did before.--- cmds-filesystem.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)cmds-filesystem.c +0
-0@@ -901,13 +901,8 @@ static int cmd_show(int argc, char **argv)* realpath do /mnt/btrfs/ => /mnt/btrfs * which shall be recognized by btrfs_scan_kernel()
cmds-filesystem.c static int cmd_show(int argc, char **argv) · line 905
Quoted 10 lines
cmds-filesystem.c +2
-7*/ -if (!realpath (search, path)) { -fprintf (stderr,"ERROR: Could not show %s: %s\n" , - search,strerror (errno)); -return 1 ; - } - - search = path; +if (realpath (search, path)) + search = path;
This looks nice and stay consistent with the behavior before my faulty commit.
Thanks,
Gui
Quoted 2 lines
cmds-filesystem.c +0
-0/* * Needs special handling if input arg is block dev And if