Skip to content

Commit 02ec537

Browse files
committed
utils/hwloc: check topology loading error status
Signed-off-by: Clément Foyer <[email protected]>
1 parent 45fb910 commit 02ec537

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

utils/hwloc/hwloc-bind.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ int main(int argc, char *argv[])
184184
hwloc_topology_set_all_types_filter(topology, HWLOC_TYPE_FILTER_KEEP_ALL);
185185
hwloc_topology_set_flags(topology, flags);
186186
ret = hwloc_topology_load(topology);
187+
if (ret < 0) {
188+
perror("Couldn't load the topology");
189+
return EXIT_FAILURE;
190+
}
187191
if (restrictstring) {
188192
hwloc_bitmap_t restrictset = hwloc_bitmap_alloc();
189193
hwloc_bitmap_sscanf(restrictset, restrictstring);
@@ -194,8 +198,6 @@ int main(int argc, char *argv[])
194198
hwloc_bitmap_free(restrictset);
195199
free(restrictstring);
196200
}
197-
if (ret < 0)
198-
return EXIT_FAILURE;
199201
depth = hwloc_topology_get_depth(topology);
200202

201203
while (argc >= 1) {

utils/hwloc/hwloc-calc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,10 @@ int main(int argc, char *argv[])
430430
if (err) return EXIT_FAILURE;
431431
}
432432
err = hwloc_topology_load(topology);
433+
if (err < 0) {
434+
perror("Couldn't load the topology");
435+
return EXIT_FAILURE;
436+
}
433437
if (restrictstring) {
434438
hwloc_bitmap_t restrictset = hwloc_bitmap_alloc();
435439
hwloc_bitmap_sscanf(restrictset, restrictstring);

0 commit comments

Comments
 (0)