]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
testsuite: always use dlsym(RTLD_NEXT, ...)
authorEmil Velikov <emil.l.velikov@gmail.com>
Sat, 24 May 2025 11:50:15 +0000 (12:50 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Thu, 29 May 2025 22:30:13 +0000 (17:30 -0500)
It has been supported by glibc, musl and bionic for years - our
supported platforms.

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/init_module.c
testsuite/path.c
testsuite/uname.c

index 35630d89b23ab369155d1d34e2d9104577b9b43c..891df6b0948306fb2d5b6a4f772ced0ecd3db4ab 100644 (file)
@@ -349,16 +349,10 @@ TS_EXPORT long int syscall(long int __sysno, ...)
        }
 
        if (__sysno == __NR_gettid) {
-               static void *nextlib = NULL;
                static long (*nextlib_syscall)(long number, ...);
 
                if (nextlib_syscall == NULL) {
-#ifdef RTLD_NEXT
-                       nextlib = RTLD_NEXT;
-#else
-                       nextlib = dlopen("libc.so.6", RTLD_LAZY);
-#endif
-                       nextlib_syscall = dlsym(nextlib, "syscall");
+                       nextlib_syscall = dlsym(RTLD_NEXT, "syscall");
                        if (nextlib_syscall == NULL) {
                                fprintf(stderr,
                                        "FIXME FIXME FIXME: could not load syscall symbol: %s\n",
index 5acc1fd46276d81a4a15dd1887d2684621c66a23..947a3915484b7f5ba55d54f5ee7c68db7853b56b 100644 (file)
@@ -26,7 +26,6 @@
 
 #include "testsuite.h"
 
-static void *nextlib;
 static const char *rootpath;
 static size_t rootpathlen;
 
@@ -84,15 +83,7 @@ static void *get_libc_func(const char *f)
 {
        void *fp;
 
-       if (nextlib == NULL) {
-#ifdef RTLD_NEXT
-               nextlib = RTLD_NEXT;
-#else
-               nextlib = dlopen("libc.so.6", RTLD_LAZY);
-#endif
-       }
-
-       fp = dlsym(nextlib, f);
+       fp = dlsym(RTLD_NEXT, f);
        assert(fp);
 
        return fp;
index 293c625d533147f90434c91ff8f11b13b09fe243..0333f7a9c799457842450561ea3429fc8a1edd25 100644 (file)
 
 TS_EXPORT int uname(struct utsname *u)
 {
-       static void *nextlib = NULL;
        static int (*nextlib_uname)(struct utsname *u);
        const char *release;
        int err;
        size_t sz;
 
-       if (nextlib == NULL) {
-#ifdef RTLD_NEXT
-               nextlib = RTLD_NEXT;
-#else
-               nextlib = dlopen("libc.so.6", RTLD_LAZY);
-#endif
-               nextlib_uname = dlsym(nextlib, "uname");
-       }
+       if (nextlib_uname == NULL)
+               nextlib_uname = dlsym(RTLD_NEXT, "uname");
 
        err = nextlib_uname(u);
        if (err < 0)