[LTP] [RFC PATCH 1/1] libswap: Pass enum instead of int to make_swapfile()
Petr Vorel
pvorel@suse.cz
Fri Jan 19 14:52:52 CET 2024
Not only that enum is better than int (we should not rely on
TST_CMD_PASS_RETVAL being 1, but also it was missing
TST_CMD_TCONF_ON_MISSING, thus on systems without mkswap test reported
wrong results on filesystems which supports swap:
TFAIL: mkswap on ext2/ext3/ext4 failed
Now it correctly print:
tst_cmd.c:75: TCONF: Couldn't find '___mkswap' in $PATH at tst_cmd.c:75
Fixes: ec51970b7 ("lib/tst_cmd_*(): Turn int pass_exit_val into enum")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Hi,
obviously OK, but before git freeze I rather post than directly push.
Kind regards,
Petr
libs/libltpswap/libswap.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libs/libltpswap/libswap.c b/libs/libltpswap/libswap.c
index d014325e5..13610709e 100644
--- a/libs/libltpswap/libswap.c
+++ b/libs/libltpswap/libswap.c
@@ -30,7 +30,8 @@ int make_swapfile(const char *swapfile, int safe)
argv[1] = swapfile;
argv[2] = NULL;
- return tst_cmd(argv, "/dev/null", "/dev/null", safe);
+ return tst_cmd(argv, "/dev/null", "/dev/null", safe ?
+ TST_CMD_PASS_RETVAL | TST_CMD_TCONF_ON_MISSING : 0);
}
/*
--
2.43.0
More information about the ltp
mailing list