mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
ziomon: fix non-zero return code in ziomon_util
Use additional variable to store return code from parse_params function for distinguishing return codes from help and version from others in ziomon_util Before patch applied: # /usr/sbin/ziomon_util --help Usage: ziomon_util [-h] [-v] [-V] [-i n] [-s n] [-Q <msgq_path> ... # echo $? 255 # /usr/sbin/ziomon_util --version ziomon_util: ziomon utilization monitor, version ... # echo $? 255 After patch applied: # /usr/sbin/ziomon_util --help Usage: ziomon_util [-h] [-v] [-V] [-i n] [-s n] [-Q <msgq_path> ... # echo $? 0 # /usr/sbin/ziomon_util --version ziomon_util: ziomon utilization monitor, version ... # echo $? 0 Signed-off-by: Fedor Loshakov <loshakov@linux.vnet.ibm.com> Suggested-by: Steffen Maier <maier@linux.vnet.ibm.com> Reviewed-by: Steffen Maier <maier@linux.vnet.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
This commit is contained in:
committed by
Stefan Haberland
parent
f0116ee79c
commit
69199219bc
@@ -1009,7 +1009,7 @@ static int parse_params(int argc, char **argv, struct options *opts)
|
||||
|
||||
if (argc <= 1) {
|
||||
print_help();
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* this is too much, but argc/2 is a reliable upper boundary
|
||||
@@ -1296,6 +1296,7 @@ int main(int argc, char **argv)
|
||||
struct timeval first_interval;
|
||||
struct ioerr_wrp *ioerr = NULL;
|
||||
int rc = 0;
|
||||
int parse_params_rc;
|
||||
|
||||
verbose = 0;
|
||||
keep_running = 1;
|
||||
@@ -1304,9 +1305,13 @@ int main(int argc, char **argv)
|
||||
|
||||
init_opts(&opts);
|
||||
|
||||
if (parse_params(argc, argv, &opts)) {
|
||||
parse_params_rc = parse_params(argc, argv, &opts);
|
||||
if (parse_params_rc < 0) {
|
||||
rc = -1;
|
||||
goto out2;
|
||||
} else if (parse_params_rc > 0) {
|
||||
rc = 0;
|
||||
goto out2;
|
||||
}
|
||||
|
||||
if (opts.msg_q_path && setup_msg_q(&opts)) {
|
||||
|
||||
Reference in New Issue
Block a user