summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-13 04:30:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-13 04:30:18 +0000
commit93cc6f1854d28c1cc0acdad5175ffb5209a04b4c (patch)
treea9afdc2cfaff1d9c2ec8409804efbd2cb94454df
parentAdding debian version 32+20240327-1. (diff)
downloadkmod-93cc6f1854d28c1cc0acdad5175ffb5209a04b4c.tar.xz
kmod-93cc6f1854d28c1cc0acdad5175ffb5209a04b4c.zip
Merging upstream version 32+20240611.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--configure.ac4
-rw-r--r--shared/missing.h10
-rw-r--r--shared/util.c2
-rw-r--r--shared/util.h1
-rw-r--r--testsuite/path.c9
-rw-r--r--testsuite/testsuite.c1
-rw-r--r--tools/depmod.c4
-rw-r--r--tools/kmod.c1
8 files changed, 27 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index a80780e..9527aa2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,7 +53,9 @@ CC_CHECK_FUNC_BUILTIN([__builtin_uaddll_overflow], [ ], [ ])
AC_CHECK_MEMBERS([struct stat.st_mtim], [], [], [#include <sys/stat.h>])
# musl 1.0 and bionic 4.4 don't have strndupa
-AC_CHECK_DECLS_ONCE([strndupa])
+# basename may be only available in libgen.h with the POSIX behavior,
+# not desired here
+AC_CHECK_DECLS_ONCE([[strndupa], [basename]], [], [], [[#include <string.h>]])
# RHEL 5 and older do not have be32toh
AC_CHECK_DECLS_ONCE([be32toh])
diff --git a/shared/missing.h b/shared/missing.h
index 2629444..7df6235 100644
--- a/shared/missing.h
+++ b/shared/missing.h
@@ -38,6 +38,7 @@ static inline int finit_module(int fd, const char *uargs, int flags)
#endif
#if !HAVE_DECL_STRNDUPA
+#include <string.h>
#define strndupa(s, n) \
({ \
const char *__old = (s); \
@@ -48,6 +49,15 @@ static inline int finit_module(int fd, const char *uargs, int flags)
})
#endif
+#if !HAVE_DECL_BASENAME
+#include <string.h>
+static inline const char *basename(const char *s)
+{
+ const char *p = strrchr(s, '/');
+ return p ? p + 1 : s;
+}
+#endif
+
#if !HAVE_DECL_BE32TOH
#include <endian.h>
#include <byteswap.h>
diff --git a/shared/util.c b/shared/util.c
index e2bab83..437bc69 100644
--- a/shared/util.c
+++ b/shared/util.c
@@ -172,7 +172,7 @@ char *modname_normalize(const char *modname, char buf[static PATH_MAX], size_t *
char *path_to_modname(const char *path, char buf[static PATH_MAX], size_t *len)
{
- char *modname;
+ const char *modname;
modname = basename(path);
if (modname == NULL || modname[0] == '\0')
diff --git a/shared/util.h b/shared/util.h
index c4a3916..2a377dd 100644
--- a/shared/util.h
+++ b/shared/util.h
@@ -5,6 +5,7 @@
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
diff --git a/testsuite/path.c b/testsuite/path.c
index 5a291b1..00935fb 100644
--- a/testsuite/path.c
+++ b/testsuite/path.c
@@ -18,6 +18,7 @@
/* We unset _FILE_OFFSET_BITS here so we can override both stat and stat64 on
* 32-bit architectures and forward each to the right libc function */
#undef _FILE_OFFSET_BITS
+#undef _TIME_BITS
#include <assert.h>
#include <dirent.h>
@@ -202,8 +203,14 @@ WRAP_2ARGS(int, -1, stat, struct stat*);
WRAP_2ARGS(int, -1, lstat, struct stat*);
WRAP_2ARGS(int, -1, stat64, struct stat64*);
WRAP_2ARGS(int, -1, lstat64, struct stat64*);
-WRAP_OPEN(64);
+struct __stat64_t64;
+extern int __stat64_time64 (const char *file, struct __stat64_t64 *buf);
+extern int __lstat64_time64 (const char *file, struct __stat64_t64 *buf);
+WRAP_2ARGS(int, -1, __stat64_time64, struct __stat64_t64*);
+WRAP_2ARGS(int, -1, __lstat64_time64, struct __stat64_t64*);
+
+WRAP_OPEN(64);
WRAP_OPEN();
#ifdef HAVE___XSTAT
diff --git a/testsuite/testsuite.c b/testsuite/testsuite.c
index 318343a..f4280be 100644
--- a/testsuite/testsuite.c
+++ b/testsuite/testsuite.c
@@ -32,6 +32,7 @@
#include <sys/stat.h>
#include <sys/wait.h>
+#include <shared/missing.h>
#include <shared/util.h>
#include "testsuite.h"
diff --git a/tools/depmod.c b/tools/depmod.c
index 06618fa..8e9e2d1 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -2638,8 +2638,8 @@ static int depmod_output(struct depmod *depmod, FILE *out)
int mode = 0644;
int fd;
- snprintf(tmp, sizeof(tmp), "%s.%i.%li.%li", itr->name, getpid(),
- tv.tv_usec, tv.tv_sec);
+ snprintf(tmp, sizeof(tmp), "%s.%i.%lli.%lli", itr->name, getpid(),
+ (long long)tv.tv_usec, (long long)tv.tv_sec);
fd = openat(dfd, tmp, flags, mode);
if (fd < 0) {
ERR("openat(%s, %s, %o, %o): %m\n",
diff --git a/tools/kmod.c b/tools/kmod.c
index 1015575..e1a73be 100644
--- a/tools/kmod.c
+++ b/tools/kmod.c
@@ -24,6 +24,7 @@
#include <string.h>
#include <shared/util.h>
+#include <shared/missing.h>
#include <libkmod/libkmod.h>