commit:     424c11684631ac417069214602b73a064524898d
Author:     Jory Pratt <anarchy <AT> gentoo <DOT> org>
AuthorDate: Wed Feb  3 15:40:11 2021 +0000
Commit:     Jory Pratt <anarchy <AT> gentoo <DOT> org>
CommitDate: Wed Feb  3 15:40:11 2021 +0000
URL:        https://gitweb.gentoo.org/proj/musl.git/commit/?id=424c1168

net-misc/networkmanager: Fix reallocarray error

Closes: https://github.com/gentoo/musl/issues/372
Package-Manager: Portage-3.0.14, Repoman-3.0.2
Signed-off-by: Jory Pratt <anarchy <AT> gentoo.org>

 net-misc/networkmanager/files/reallocarray.patch   | 22 ++++++++++++++++++++++
 .../networkmanager/networkmanager-1.26.4.ebuild    |  3 ++-
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/net-misc/networkmanager/files/reallocarray.patch 
b/net-misc/networkmanager/files/reallocarray.patch
new file mode 100644
index 0000000..98722f0
--- /dev/null
+++ b/net-misc/networkmanager/files/reallocarray.patch
@@ -0,0 +1,22 @@
+musl [added support for reallocarray](0), but the function prototype is
+declared in `stdlib.h` instead of `malloc.h`.
+
+Update the check for reallocarray to check both in `malloc.h` and
+`stdlib.h`.
+
+[0]:https://git.musl-libc.org/cgit/musl/commit/?id=821083ac7b54eaa040d5a8ddc67c6206a175e0ca
+
+diff --git a/meson.build b/meson.build
+index 22a3c4c..12a10c5 100644
+--- a/meson.build
++++ b/meson.build
+@@ -126,7 +126,8 @@ config_h.set10('HAVE_RT_SIGQUEUEINFO', 
cc.has_function('rt_sigqueueinfo', prefix
+                                                                               
       #include <sys/wait.h>'''))
+ config_h.set('HAVE_SECURE_GETENV', cc.has_function('secure_getenv'))
+ config_h.set('HAVE___SECURE_GETENV', cc.has_function('__secure_getenv'))
+-config_h.set10('HAVE_DECL_REALLOCARRAY', cc.has_function('reallocarray', 
prefix: '#include <malloc.h>'))
++config_h.set10('HAVE_DECL_REALLOCARRAY', cc.has_function('reallocarray', 
prefix: '''#include <malloc.h>
++                                                                              
      #include <stdlib.h>'''))
+ config_h.set10('HAVE_DECL_EXPLICIT_BZERO', cc.has_function('explicit_bzero', 
prefix: '#include <string.h>'))
+ config_h.set10('HAVE_DECL_MEMFD_CREATE', cc.has_function('memfd_create', 
prefix: '#include <sys/mman.h>'))
+ 

diff --git a/net-misc/networkmanager/networkmanager-1.26.4.ebuild 
b/net-misc/networkmanager/networkmanager-1.26.4.ebuild
index ff6099b..50d95a0 100644
--- a/net-misc/networkmanager/networkmanager-1.26.4.ebuild
+++ b/net-misc/networkmanager/networkmanager-1.26.4.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -108,6 +108,7 @@ PATCHES=( "${FILESDIR}"/${PN}-1.26.4-iwd-fixes-pr640.patch
        "${FILESDIR}"/musl-process-util.patch
        "${FILESDIR}"/musl-compar.patch
        "${FILESDIR}"/musl-no-drand.patch
+       "${FILESDIR}"/reallocarray.patch
 )
 
 python_check_deps() {

Reply via email to