usage of strndupa is neither C99 nor POSIX,
so musl libc does not implement it.
it's a glibc invention, and a dangerous one since
usage of alloca() is considered bad practice.

fixes build with musl libc.

Signed-off-by: John Spencer <[email protected]>

---
 libkmod/libkmod-util.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/libkmod/libkmod-util.c b/libkmod/libkmod-util.c
index d686250..9615d0f 100644
--- a/libkmod/libkmod-util.c
+++ b/libkmod/libkmod-util.c
@@ -28,6 +28,7 @@
 #include <unistd.h>
 #include <errno.h>
 #include <string.h>
+#include <limits.h>
 #include <ctype.h>
 
 #include "libkmod.h"
@@ -323,8 +324,11 @@ static inline int is_dir(const char *path)
 int mkdir_p(const char *path, int len, mode_t mode)
 {
        char *start, *end;
-
-       start = strndupa(path, len);
+       char buf[PATH_MAX+1];
+       snprintf(buf, sizeof buf, "%s", path);
+       assert(len < sizeof(buf));
+       buf[len] = 0;
+       start = buf;
        end = start + len;
 
        /*
-- 
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to