summaryrefslogtreecommitdiffstats
path: root/shared
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
commit699034d85536ab2090282d2fa7bd8cc4825ce693 (patch)
treee0d85a190b3d434f7270a4e900441c636e46b387 /shared
parentAdding upstream version 32+20240327. (diff)
downloadkmod-upstream.tar.xz
kmod-upstream.zip
Adding upstream version 32+20240611.upstream/32+20240611upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--shared/missing.h10
-rw-r--r--shared/util.c2
-rw-r--r--shared/util.h1
3 files changed, 12 insertions, 1 deletions
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>