Auto-update libkmod to v31 (#3196)
* Update libkmod to v31
* patch basename
* fix patch
* add v32
* Revert "add v32"
This reverts commit 2b315bbde8
.
---------
Co-authored-by: star9029 <hengxings783@gmail.com>
pull/3514/head
parent
c1cdc7419c
commit
798d28964e
2 changed files with 59 additions and 6 deletions
@ -0,0 +1,54 @@ |
|||||||
|
diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c
|
||||||
|
index e83621b..8aa555a 100644
|
||||||
|
--- a/libkmod/libkmod-config.c
|
||||||
|
+++ b/libkmod/libkmod-config.c
|
||||||
|
@@ -794,7 +794,7 @@ static int conf_files_insert_sorted(struct kmod_ctx *ctx,
|
||||||
|
bool is_single = false;
|
||||||
|
|
||||||
|
if (name == NULL) {
|
||||||
|
- name = basename(path);
|
||||||
|
+ name = gnu_basename(path);
|
||||||
|
is_single = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/shared/util.c b/shared/util.c
|
||||||
|
index e2bab83..0e16670 100644
|
||||||
|
--- a/shared/util.c
|
||||||
|
+++ b/shared/util.c
|
||||||
|
@@ -172,9 +172,9 @@ 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);
|
||||||
|
+ modname = gnu_basename(path);
|
||||||
|
if (modname == NULL || modname[0] == '\0')
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
diff --git a/shared/util.h b/shared/util.h
|
||||||
|
index c4a3916..073dc5a 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>
|
||||||
|
@@ -76,6 +77,12 @@ do { \
|
||||||
|
__p->__v = (val); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
+static _always_inline_ const char *gnu_basename(const char *s)
|
||||||
|
+{
|
||||||
|
+ const char *p = strrchr(s, '/');
|
||||||
|
+ return p ? p+1 : s;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static _always_inline_ unsigned int ALIGN_POWER2(unsigned int u)
|
||||||
|
{
|
||||||
|
return 1 << ((sizeof(u) * 8) - __builtin_clz(u - 1));
|
Loading…
Reference in new issue