fuse: prevent error message "can't shift that many"

On systems where /bin/sh is not Bash, running plain mount.glusterfs
gives the unhelpful error "can't shift that many".

The argument parsing can be a little improved. Adding a check for the
number of arguments, minimal two (Gluster ip:/volume, and mountpoint),
but possibly more (-o, -v etc.).

With the additional check, running 'mount.glusterfs -h' now shows the
following messags:

    Usage: /sbin/mount.glusterfs <server>:<volume/subdir> <mountpoint> -o<options>
    Options:
    man 8 mount.glusterfs
    To display the version number of the mount helper: /sbin/mount.glusterfs -V

Change-Id: I50e3ade0c6217fab4155f35ad8cb35d99d52e133
Fixes: bz#1564890
Reported-by: Alexander Zimmermann <alexander.zimmermann96@gmail.com>
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2018-09-28 10:46:46 +02:00 committed by Amar Tumballi
parent baeb5fb5ca
commit 1f2aa9acb7

View File

@ -366,9 +366,9 @@ start_glusterfs ()
print_usage ()
{
cat << EOF
Usage: $0 <volumeserver>:<volumeid/volumeport> -o<options> <mountpoint>
Usage: $0 <server>:<volume/subdir> <mountpoint> -o<options>
Options:
man 8 $0
man 8 $(basename $0)
To display the version number of the mount helper: $0 -V
EOF
}
@ -670,7 +670,7 @@ update_updatedb()
main ()
{
if [ "x${uname_s}" = "xLinux" ] ; then
if [ "x${uname_s}" = "xLinux" -a $# -ge 2 ] ; then
volfile_loc=$1
mount_point=$2