]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
testsuite/test-{init,remove}: don't use %m with kmod API
authorEmil Velikov <emil.l.velikov@gmail.com>
Wed, 4 Jun 2025 16:16:25 +0000 (17:16 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Wed, 11 Jun 2025 13:03:26 +0000 (08:03 -0500)
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 <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/368
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
testsuite/test-init.c
testsuite/test-remove.c

index 4bb12e2175bc1350f7fc00b5277f2dedcc66013c..d9b8f3af68005a8d5081b6112e0b5ef661ff80b7 100644 (file)
@@ -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);
index 88e6f8eb324b6e7d7c732fcecbec8fb012396d97..1cf47d8e5f757b10e3a380c5092cfc6122b2b623 100644 (file)
@@ -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);
        }