diff options
author | Petr Vorel <pvorel@suse.cz> | 2024-01-19 14:41:24 +0100 |
---|---|---|
committer | Petr Vorel <pvorel@suse.cz> | 2024-01-22 08:06:15 +0100 |
commit | d337682f16702e378293f9e397bbb34906fe64d2 (patch) | |
tree | 2ab7b54f609709bb7c874a79d1de00e2e069e19a | |
parent | ec14c81d04eecca90684c37c66aad9560ad6a6f3 (diff) | |
download | ltp-d337682f16702e378293f9e397bbb34906fe64d2.tar.gz |
libswap: Pass enum instead of int to make_swapfile()
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
Link: https://lore.kernel.org/ltp/20240119135252.32420-1-pvorel@suse.cz/
Fixes: ec51970b7 ("lib/tst_cmd_*(): Turn int pass_exit_val into enum")
Reviewed-by: Li Wang <liwang@redhat.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
-rw-r--r-- | libs/libltpswap/libswap.c | 3 |
1 files changed, 2 insertions, 1 deletions
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); } /* |