]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
testsuite/path: match the full rootpath
authorEmil Velikov <emil.l.velikov@gmail.com>
Thu, 22 Aug 2024 16:04:21 +0000 (17:04 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Fri, 23 Aug 2024 18:51:19 +0000 (13:51 -0500)
Our expectation is that the (full) rootpath is present, otherwise we
prepend it ourselves. Drop the ABS_TOP_BUILDDIR instance.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Makefile.am
shared/util.h
testsuite/path.c

index 370332f512853c328d10a743466ece3724db5dcb..013569864ac86d06aa59c47d037844a27fdcc12f 100644 (file)
@@ -232,8 +232,6 @@ EXTRA_DIST += \
 check_LTLIBRARIES = $(TESTSUITE_OVERRIDE_LIBS)
 
 testsuite_uname_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
-testsuite_path_la_CPPFLAGS = $(AM_CPPFLAGS) \
-       -DABS_TOP_BUILDDIR=\"$(abs_top_builddir)\"
 testsuite_path_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
 
 testsuite_delete_module_la_LDFLAGS = $(TESTSUITE_OVERRIDE_LIBS_LDFLAGS)
index f479b94fead66f5068049a506e53d02fd96cd24a..2671ac9b15ef33bb4380a6f1477a0980d22a191d 100644 (file)
@@ -16,6 +16,7 @@
 /* ************************************************************************ */
 #define streq(a, b) (strcmp((a), (b)) == 0)
 #define strstartswith(a, b) (strncmp(a, b, strlen(b)) == 0)
+#define strnstartswith(a, b, n) (strncmp(a, b, n) == 0)
 char *strchr_replace(char *s, char c, char r);
 void *memdup(const void *p, size_t n) __attribute__((nonnull(1)));
 
index 7c5fa6c8e6e7eb8bafe812ee16b38b084a5c1c8c..2a2670f72683ac6749a87ff50d8ef138d1b7d077 100644 (file)
@@ -33,7 +33,7 @@ static size_t rootpathlen;
 static inline bool need_trap(const char *path)
 {
        return path != NULL && path[0] == '/'
-               && !strstartswith(path, ABS_TOP_BUILDDIR);
+               && !strnstartswith(path, rootpath, rootpathlen);
 }
 
 static const char *trap_path(const char *path, char buf[PATH_MAX * 2])