* [PATCH] btrfs-progs: Fix btrfs fi show by uuid and label
@ 2014-12-23 19:34 Justin Maggard
2014-12-24 1:28 ` Gui Hecheng
0 siblings, 1 reply; 2+ messages in thread
From: Justin Maggard @ 2014-12-23 19:34 UTC (permalink / raw)
To: linux-btrfs; +Cc: 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.
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(-)
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index 8f037dd..a654e6f 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -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
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs-progs: Fix btrfs fi show by uuid and label
2014-12-23 19:34 [PATCH] btrfs-progs: Fix btrfs fi show by uuid and label Justin Maggard
@ 2014-12-24 1:28 ` Gui Hecheng
0 siblings, 0 replies; 2+ messages in thread
From: Gui Hecheng @ 2014-12-24 1:28 UTC (permalink / raw)
To: Justin Maggard; +Cc: linux-btrfs
On Tue, 2014-12-23 at 11:34 -0800, Justin Maggard wrote:
> 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.
> 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(-)
>
> diff --git a/cmds-filesystem.c b/cmds-filesystem.c
> index 8f037dd..a654e6f 100644
> --- a/cmds-filesystem.c
> +++ b/cmds-filesystem.c
> @@ -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;
This looks nice and stay consistent with the behavior before my faulty
commit.
Reviewed-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Thanks,
Gui
> /*
> * Needs special handling if input arg is block dev And if
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-12-24 1:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-23 19:34 [PATCH] btrfs-progs: Fix btrfs fi show by uuid and label Justin Maggard
2014-12-24 1:28 ` Gui Hecheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).