Skip to content

Commit 2fbcce8

Browse files
committed
xdp-forward: Don't use errno as program exit code
Converting errno returns to program exit status means we may end up returning SKIPPED_TEST, which messes with the selftests. Change this to always use EXIT_SUCCESS/EXIT_FAILURE instead. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
1 parent 765244f commit 2fbcce8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

xdp-forward/xdp-forward.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,7 @@ static int do_load(const void *cfg, __unused const char *pin_root_path)
202202
opts.obj = obj;
203203
xdp_prog = xdp_program__create(&opts);
204204
if (!xdp_prog) {
205-
ret = -errno;
206-
pr_warn("Couldn't open XDP program: %s\n",
207-
strerror(-ret));
205+
pr_warn("Couldn't open XDP program: %s\n", strerror(errno));
208206
goto end_destroy;
209207
}
210208

@@ -245,6 +243,8 @@ static int do_load(const void *cfg, __unused const char *pin_root_path)
245243
pr_info("Loaded on interface %s\n", iface->ifname);
246244
}
247245

246+
ret = EXIT_SUCCESS;
247+
248248
end_destroy:
249249
if (opt->fwd_mode == FWD_FLOWTABLE)
250250
xdp_flowtable__destroy(skel);
@@ -254,6 +254,7 @@ static int do_load(const void *cfg, __unused const char *pin_root_path)
254254
return ret;
255255

256256
end_detach:
257+
ret = EXIT_FAILURE;
257258
for (iface = opt->ifaces; iface; iface = iface->next)
258259
xdp_program__detach(xdp_prog, iface->ifindex, opt->xdp_mode, 0);
259260
goto end_destroy;

0 commit comments

Comments
 (0)