Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: subvol show could take more than one subvol
@ 2013-04-19  9:38 Anand Jain
  2013-04-19 10:00 ` Stefan Behrens
  0 siblings, 1 reply; 2+ messages in thread
From: Anand Jain @ 2013-04-19  9:38 UTC (permalink / raw)
  To: linux-btrfs

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 cmds-subvolume.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index 74e2130..e3b8032 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -800,16 +800,18 @@ static int cmd_subvol_show(int argc, char **argv)
 	struct btrfs_list_filter_set *filter_set;
 	char tstr[256];
 	char uuidparse[37];
-	char *fullpath = NULL, *svpath = NULL, *mnt = NULL;
+	char *fullpath, *svpath = NULL, *mnt;
 	char raw_prefix[] = "\t\t\t\t";
 	u64 sv_id, mntid;
 	int fd = -1, mntfd = -1;
 	int ret = -1;
 
-	if (check_argc_exact(argc, 2))
+	if (check_argc_min(argc, 2))
 		usage(cmd_subvol_show_usage);
-
-	fullpath = realpath(argv[1], 0);
+again:
+	mnt = NULL;
+	fullpath = NULL;
+	fullpath = realpath(argv[optind++], 0);
 	if (!fullpath) {
 		fprintf(stderr, "ERROR: finding real path for '%s', %s\n",
 			argv[1], strerror(errno));
@@ -939,6 +941,8 @@ out:
 	if (fullpath)
 		free(fullpath);
 
+	if (optind < argc)
+		goto again;
 	return ret;
 }
 
-- 
1.8.1.227.g44fe835


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] btrfs-progs: subvol show could take more than one subvol
  2013-04-19  9:38 [PATCH] btrfs-progs: subvol show could take more than one subvol Anand Jain
@ 2013-04-19 10:00 ` Stefan Behrens
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Behrens @ 2013-04-19 10:00 UTC (permalink / raw)
  To: Anand Jain; +Cc: linux-btrfs

On Fri, 19 Apr 2013 17:38:29 +0800, Anand Jain wrote:
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  cmds-subvolume.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/cmds-subvolume.c b/cmds-subvolume.c
> index 74e2130..e3b8032 100644
> --- a/cmds-subvolume.c
> +++ b/cmds-subvolume.c
> @@ -800,16 +800,18 @@ static int cmd_subvol_show(int argc, char **argv)
>  	struct btrfs_list_filter_set *filter_set;
>  	char tstr[256];
>  	char uuidparse[37];
> -	char *fullpath = NULL, *svpath = NULL, *mnt = NULL;
> +	char *fullpath, *svpath = NULL, *mnt;
>  	char raw_prefix[] = "\t\t\t\t";
>  	u64 sv_id, mntid;
>  	int fd = -1, mntfd = -1;
>  	int ret = -1;
>  
> -	if (check_argc_exact(argc, 2))
> +	if (check_argc_min(argc, 2))
>  		usage(cmd_subvol_show_usage);
> -
> -	fullpath = realpath(argv[1], 0);
> +again:
> +	mnt = NULL;
> +	fullpath = NULL;

The "fullpath = NULL" line above is not needed because of the following
line.

> +	fullpath = realpath(argv[optind++], 0);
>  	if (!fullpath) {
>  		fprintf(stderr, "ERROR: finding real path for '%s', %s\n",
>  			argv[1], strerror(errno));

                        argv[optind - 1], strerror(errno));


> @@ -939,6 +941,8 @@ out:
>  	if (fullpath)
>  		free(fullpath);
>  
> +	if (optind < argc)
> +		goto again;
>  	return ret;
>  }
>  
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-19 10:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-19  9:38 [PATCH] btrfs-progs: subvol show could take more than one subvol Anand Jain
2013-04-19 10:00 ` Stefan Behrens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox