mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
cpumf/lscpumf.c: Check for help and version options first
Check command line arguments for help text and version string first, before doing any action. This ensures this information is always printed, even when invoked as non-root user. Fixes: https://github.com/ibm-s390-tools/s390-tools/issues/97 Signed-off-by: Thomas Richter <tmricht@linux.ibm.com> Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
d619b492e9
commit
86685f001d
@@ -3095,11 +3095,11 @@ int main(int argc, char **argv)
|
||||
util_prg_init(&prg);
|
||||
util_opt_init(opt_vec, NULL);
|
||||
|
||||
ret = read_info();
|
||||
if (ret == EXIT_FAILURE)
|
||||
return ret;
|
||||
ret = parse_args(argc, argv);
|
||||
if (read_info() == EXIT_FAILURE)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
switch ((ret = parse_args(argc, argv))) {
|
||||
switch (ret) {
|
||||
case ACTION_CNT:
|
||||
case ACTION_CNTALL:
|
||||
all = ret == ACTION_CNTALL;
|
||||
@@ -3115,6 +3115,7 @@ int main(int argc, char **argv)
|
||||
case ACTION_NONE:
|
||||
case ACTION_INFO:
|
||||
show_info(&cpumf, ret == ACTION_INFO);
|
||||
ret = EXIT_SUCCESS;
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user