]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
testsuite: fprintf() + abort() when dlsym() returns NULL
authorEmil Velikov <emil.l.velikov@gmail.com>
Sat, 24 May 2025 11:57:11 +0000 (12:57 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Thu, 29 May 2025 22:30:13 +0000 (17:30 -0500)
Currently each of our three dlsym() instances behaves differently. From
seg-faulting, to abort() to assert(). Just use abort throughout, since
assert() is no-op when NDEBUG is defined.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/355
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
testsuite/path.c
testsuite/uname.c

index 947a3915484b7f5ba55d54f5ee7c68db7853b56b..06060b85be5b0b14f1c6fd7ce0a1435046a5ad6e 100644 (file)
@@ -84,7 +84,11 @@ static void *get_libc_func(const char *f)
        void *fp;
 
        fp = dlsym(RTLD_NEXT, f);
-       assert(fp);
+       if (fp == NULL) {
+               fprintf(stderr, "FIXME FIXME FIXME: could not load %s symbol: %s\n", f,
+                       dlerror());
+               abort();
+       }
 
        return fp;
 }
index 0333f7a9c799457842450561ea3429fc8a1edd25..ffd274dce4bbcce86fbca2a1af0898d728630235 100644 (file)
@@ -20,8 +20,15 @@ TS_EXPORT int uname(struct utsname *u)
        int err;
        size_t sz;
 
-       if (nextlib_uname == NULL)
+       if (nextlib_uname == NULL) {
                nextlib_uname = dlsym(RTLD_NEXT, "uname");
+               if (nextlib_uname == NULL) {
+                       fprintf(stderr,
+                               "FIXME FIXME FIXME: could not load uname symbol: %s\n",
+                               dlerror());
+                       abort();
+               }
+       }
 
        err = nextlib_uname(u);
        if (err < 0)