All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Dickson <SteveD@RedHat.com>
To: "Jianhong.Yin" <yin-jianhong@163.com>
Cc: linux-nfs@vger.kernel.org, jiyin@redhat.com
Subject: Re: [PATCH] [nfs-utils] utils/mount/mount.c: fix args parse error
Date: Thu, 27 Feb 2020 10:41:08 -0500	[thread overview]
Message-ID: <bd7cd204-64db-40e9-d646-74e5b26b94de@RedHat.com> (raw)
In-Reply-To: <20200224034336.9667-1-yin-jianhong@163.com>



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...
>  	 */
> 


           reply	other threads:[~2020-02-27 15:41 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20200224034336.9667-1-yin-jianhong@163.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bd7cd204-64db-40e9-d646-74e5b26b94de@RedHat.com \
    --to=steved@redhat.com \
    --cc=jiyin@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=yin-jianhong@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.