mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zdump: only mount command uses the optional arguments
Currently, for some commands (e.g. `zgetdump unmount`) unused positional arguments are silently ignored, for some commands (`zgetdump mount`) they're not. Therefore let's fix this by always returning an error message and exit code if too many positional arguments are given. Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
800ef7cb13
commit
f247850ff0
@@ -233,7 +233,7 @@ static void parse_pos_args(struct options *opts, char *argv[], int argc)
|
||||
case ZG_ACTION_DEVICE_INFO:
|
||||
if (pos_args == 0)
|
||||
ERR_EXIT("No device or dump specified");
|
||||
if (pos_args > 1 && !opts->debug_specified)
|
||||
if (pos_args > 1)
|
||||
ERR_EXIT("Too many positional parameters specified");
|
||||
device_set(opts, argv[optind]);
|
||||
break;
|
||||
@@ -252,6 +252,8 @@ static void parse_pos_args(struct options *opts, char *argv[], int argc)
|
||||
case ZG_ACTION_UMOUNT:
|
||||
if (pos_args == 0)
|
||||
ERR_EXIT("No mount point specified");
|
||||
if (pos_args > 1)
|
||||
ERR_EXIT("Too many positional parameters specified");
|
||||
mount_point_set(opts, argv[optind]);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user