From e8e412239037669b89aa657a3a9d7d7b9bddd3e7 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Wed, 4 Jun 2025 17:16:25 +0100 Subject: [PATCH] testsuite/test-{init,remove}: don't use %m with kmod API The kmod API returns the error code directly, which one should be used alongside strerror(). Using %m may return a different result all together. Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/368 Signed-off-by: Lucas De Marchi --- testsuite/test-init.c | 4 ++-- testsuite/test-remove.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/testsuite/test-init.c b/testsuite/test-init.c index 4bb12e21..d9b8f3af 100644 --- a/testsuite/test-init.c +++ b/testsuite/test-init.c @@ -86,13 +86,13 @@ static noreturn int test_insert(void) err = kmod_module_new_from_path(ctx, "/mod-simple.ko", &mod); if (err != 0) { - ERR("could not create module from path: %m\n"); + ERR("could not create module from path: %s\n", strerror(-err)); exit(EXIT_FAILURE); } err = kmod_module_insert_module(mod, 0, NULL); if (err != 0) { - ERR("could not insert module: %m\n"); + ERR("could not insert module: %s\n", strerror(-err)); exit(EXIT_FAILURE); } kmod_unref(ctx); diff --git a/testsuite/test-remove.c b/testsuite/test-remove.c index 88e6f8eb..1cf47d8e 100644 --- a/testsuite/test-remove.c +++ b/testsuite/test-remove.c @@ -31,19 +31,19 @@ static noreturn int test_remove(void) err = kmod_module_new_from_path(ctx, "/mod-simple.ko", &mod); if (err != 0) { - ERR("could not create module from path: %m\n"); + ERR("could not create module from path: %s\n", strerror(-err)); exit(EXIT_FAILURE); } err = kmod_module_insert_module(mod, 0, NULL); if (err != 0) { - ERR("could not insert module: %m\n"); + ERR("could not insert module: %s\n", strerror(-err)); exit(EXIT_FAILURE); } err = kmod_module_remove_module(mod, 0); if (err != 0) { - ERR("could not remove module: %m\n"); + ERR("could not remove module: %s\n", strerror(-err)); exit(EXIT_FAILURE); } -- 2.47.2