linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] [nfs-utils] utils/mount/mount.c: fix args parse error
       [not found] <20200224034336.9667-1-yin-jianhong@163.com>
@ 2020-02-27 15:41 ` Steve Dickson
  0 siblings, 0 replies; only message in thread
From: Steve Dickson @ 2020-02-27 15:41 UTC (permalink / raw)
  To: Jianhong.Yin; +Cc: linux-nfs, jiyin



On 2/23/20 10:43 PM, Jianhong.Yin wrote:
> From: Jianhong Yin <yin-jianhong@163.com>
> 
> argc number checking should be after getopt_long(), otherwise
> we'll get follow result:
> '''
> ~]# mount.nfs -V
> usage: mount.nfs remotetarget dir [-rvVwfnsh] [-o nfsoptions]
> options:
>         -r              Mount file system readonly
>         -v              Verbose
>         -V              Print version
>         -w              Mount file system read-write
>         -f              Fake mount, do not actually mount
>         -n              Do not update /etc/mtab
>         -s              Tolerate sloppy mount options rather than fail
>         -h              Print this help
>         nfsoptions      Refer to mount.nfs(8) or nfs(5)
> '''
> 
> after fix:
> '''
> ~]# mount.nfs -V
> mount.nfs: (linux nfs-utils 2.4.3)
> '''
> 
> Signed-off-by: Jianhong Yin <yin-jianhong@163.com>
Committed... 

steved.

> ---
>  utils/mount/mount.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/utils/mount/mount.c b/utils/mount/mount.c
> index 2be3dc2f..b98f9e00 100644
> --- a/utils/mount/mount.c
> +++ b/utils/mount/mount.c
> @@ -393,11 +393,6 @@ int main(int argc, char *argv[])
>  	if(!strncmp(progname, "umount", strlen("umount")))
>  		exit(nfsumount(argc, argv));
>  
> -	if ((argc < 3)) {
> -		mount_usage();
> -		exit(EX_USAGE);
> -	}
> -
>  	mount_config_init(progname);
>  
>  	while ((c = getopt_long(argc, argv, "rvVwfno:hs",
> @@ -437,6 +432,11 @@ int main(int argc, char *argv[])
>  		}
>  	}
>  
> +	if ((argc < 3)) {
> +		mount_usage();
> +		exit(EX_USAGE);
> +	}
> +
>  	/*
>  	 * Extra non-option words at the end are bogus...
>  	 */
> 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-02-27 15:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20200224034336.9667-1-yin-jianhong@163.com>
2020-02-27 15:41 ` [PATCH] [nfs-utils] utils/mount/mount.c: fix args parse error Steve Dickson

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).