DEPEND="${COMMON_DEPEND}"
RDEPEND="${COMMON_DEPEND}"
+PATCHES=(
+ "${FILESDIR}/${P}-delete_tmpfiles.patch"
+ "${FILESDIR}/${P}-fix_check_for_open_memstream.patch"
+)
+
src_configure() {
local myeconfargs=(
--dbdir="${EPREFIX}/var/lib/dhcpcd"
--- /dev/null
+From 79846b358f6ea8d0a6027ee0ba38342a730065b0 Mon Sep 17 00:00:00 2001
+From: Roy Marples <roy@marples.name>
+Date: Sun, 28 Jul 2019 11:49:17 +0100
+Subject: script: ensure that tmp files are removed
+
+fopen creates a new stream which will use a new fd.
+Why using fdopen, the new stream will use the same fd, so when
+it's closed the tmp file will really unlink.
+---
+ src/script.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/src/script.c b/src/script.c
+index 1863a661..74aef1b1 100644
+--- a/src/script.c
++++ b/src/script.c
+@@ -213,10 +213,11 @@ make_env(const struct interface *ifp, const char *reason)
+ if (tmpfd == -1)
+ goto eexit;
+ unlink(tmpfile);
+- fp = fopen(tmpfile, "w+");
+- close(tmpfd);
+- if (fp == NULL)
++ fp = fdopen(tmpfd, "w+");
++ if (fp == NULL) {
++ close(tmpfd);
+ goto eexit;
++ }
+ #endif
+
+ #ifdef INET
+--
+cgit v1.2.1
+
--- /dev/null
+From fa7f0d1e0a57bfaca49e1cfdc3d292ef1d68001a Mon Sep 17 00:00:00 2001
+From: Roy Marples <roy@marples.name>
+Date: Sun, 28 Jul 2019 12:53:03 +0100
+Subject: configure: Fix test for open_memstream
+
+glibc-2.19 needs the return value testing....
+---
+ configure | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/configure b/configure
+index d25eec56..50058520 100755
+--- a/configure
++++ b/configure
+@@ -747,8 +747,7 @@ if [ -z "$OPEN_MEMSTREAM" ]; then
+ cat <<EOF >_open_memstream.c
+ #include <stdio.h>
+ int main(void) {
+- open_memstream(NULL, NULL);
+- return 0;
++ return open_memstream(NULL, NULL) != NULL ? 0 : 1;
+ }
+ EOF
+ if $XCC _open_memstream.c -o _open_memstream 2>&3; then
+--
+cgit v1.2.1
+