Skip to content

Commit 7b3262f

Browse files
committed
hwloc-info: error-out if some options are given after some locations
Signed-off-by: Brice Goglin <[email protected]>
1 parent d84ec38 commit 7b3262f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

utils/hwloc/hwloc-info.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,9 @@ main (int argc, char *argv[])
685685
while (argc >= 1) {
686686
if (!strcmp(argv[0], "all") || !strcmp(argv[0], "root")) {
687687
hwloc_calc_process_location_info_cb(&lcontext, NULL, hwloc_get_root_obj(topology));
688+
} else if (*argv[0] == '-') {
689+
fprintf(stderr, "Cannot handle command-line option %s after some locations.\n", argv[0]);
690+
return EXIT_FAILURE;
688691
} else {
689692
/* try to match a type/depth followed by a special character */
690693
typelen = strspn(argv[0], "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");

0 commit comments

Comments
 (0)