diff mbox series

[5/6] sysvinit: Include libgen.h for basename API

Message ID 20231210202549.155550-5-raj.khem@gmail.com
State Accepted, archived
Commit 63732c7accf802aab106a85d7d3852a689d9beaf
Headers show
Series [1/6] opkg: Use own version of portable basename function | expand

Commit Message

Khem Raj Dec. 10, 2023, 8:25 p.m. UTC
This fixes build with latest musl which drops basename declaration API from string.h

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...wn-include-libgen.h-for-basename-API.patch | 38 +++++++++++++++++++
 meta/recipes-core/sysvinit/sysvinit_3.04.bb   |  1 +
 2 files changed, 39 insertions(+)
 create mode 100644 meta/recipes-core/sysvinit/sysvinit/0001-hddown-include-libgen.h-for-basename-API.patch
diff mbox series

Patch

diff --git a/meta/recipes-core/sysvinit/sysvinit/0001-hddown-include-libgen.h-for-basename-API.patch b/meta/recipes-core/sysvinit/sysvinit/0001-hddown-include-libgen.h-for-basename-API.patch
new file mode 100644
index 00000000000..5e4053bad1d
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/0001-hddown-include-libgen.h-for-basename-API.patch
@@ -0,0 +1,38 @@ 
+From a07c1d94e79840c59563741b45e690e77d4f3dfa Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 3 Dec 2023 20:09:30 -0800
+Subject: [PATCH] hddown: include libgen.h for basename API
+
+musl has removed the non-prototype declaration of basename from string.h [1] which now results in build errors with clang-17+ compiler
+
+include libgen.h for using the posix declaration of the funciton.
+
+Fixes
+
+hddown.c:135:8: error: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
+  135 |                         ptr = basename(lnk);
+      |                             ^ ~~~~~~~~~~~~~
+
+[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7
+
+Upstream-Status: Submitted [https://github.com/slicer69/sysvinit/pull/21]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/hddown.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/hddown.c b/src/hddown.c
+index 7a2cf28..3b31bc0 100644
+--- a/src/hddown.c
++++ b/src/hddown.c
+@@ -24,6 +24,7 @@ char *v_hddown = "@(#)hddown.c  1.02  22-Apr-2003  miquels@cistron.nl";
+ #ifndef _GNU_SOURCE
+ #define _GNU_SOURCE
+ #endif
++#include <libgen.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+-- 
+2.43.0
+
diff --git a/meta/recipes-core/sysvinit/sysvinit_3.04.bb b/meta/recipes-core/sysvinit/sysvinit_3.04.bb
index 76b187c1961..6a612468f35 100644
--- a/meta/recipes-core/sysvinit/sysvinit_3.04.bb
+++ b/meta/recipes-core/sysvinit/sysvinit_3.04.bb
@@ -21,6 +21,7 @@  SRC_URI = "${SAVANNAH_GNU_MIRROR}/sysvinit/sysvinit-${PV}.tar.xz \
            file://rcS \
            file://bootlogd.init \
            file://01_bootlogd \
+           file://0001-hddown-include-libgen.h-for-basename-API.patch \
            "
 SRC_URI[sha256sum] = "2a621fe6e4528bc91308b74867ddaaebbdf7753f02395c0c5bae817bd2b7e3a5"