kmod: add patch from sabotage to make this build with musl.

This commit is contained in:
Juan RP 2014-01-11 11:05:12 +01:00
parent 2963e21ea0
commit 56cecec561
2 changed files with 34 additions and 5 deletions

View file

@ -0,0 +1,32 @@
remove non-portable usage of strndupa
usage of strndupa is neither C99 nor POSIX,
it's a glibc invention, and a dangerous one since
alloca() is used behind the scenes which does not
give any guarantuees that it won't overflow the
stack.
--- libkmod/libkmod-util.c 2013-08-26 16:03:22.239000003 +0000
+++ libkmod/libkmod-util.c 2013-08-26 16:07:26.684000003 +0000
@@ -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 @@
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;
/*

View file

@ -1,7 +1,7 @@
# Template file for 'kmod'
pkgname=kmod
version=16
revision=1
revision=2
build_style=gnu-configure
configure_args="--with-zlib --with-xz"
hostmakedepends="pkg-config libxslt"
@ -17,9 +17,6 @@ license="GPL-2"
homepage="http://git.profusion.mobi/cgit.cgi/kmod.git"
distfiles="${KERNEL_SITE}/utils/kernel/kmod/kmod-${version}.tar.xz"
checksum=63412efab37c70459ccef167556965c93fd4f56af5986cd3750542a684c613c5
long_desc="
kmod is a set of tools to handle common tasks with Linux kernel modules like
insert, remove, list, check properties, resolve dependencies and aliases."
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" libtool automake"
@ -46,7 +43,7 @@ libkmod_package() {
}
libkmod-devel_package() {
depends="zlib-devel liblzma-devel libkmod>=${version}"
depends="zlib-devel liblzma-devel libkmod>=${version}_${revision}"
short_desc+=" - development files"
pkg_install() {
vmove usr/include