diff mbox series

[RFC,1/1] libswap: Pass enum instead of int to make_swapfile()

Message ID 20240119135252.32420-1-pvorel@suse.cz
State Accepted
Headers show
Series [RFC,1/1] libswap: Pass enum instead of int to make_swapfile() | expand

Commit Message

Petr Vorel Jan. 19, 2024, 1:52 p.m. UTC
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(-)

Comments

Li Wang Jan. 20, 2024, 8:34 a.m. UTC | #1
Reviewed-by: Li Wang <liwang@redhat.com>
Petr Vorel Jan. 22, 2024, 7:07 a.m. UTC | #2
Hi Li,

> Reviewed-by: Li Wang <liwang@redhat.com>

Thanks, merged!

Kind regards,
Petr
diff mbox series

Patch

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);
 }
 
 /*