sysvinit: Include libgen.h for basename API

This fixes build with latest musl which drops basename declaration API from string.h

(From OE-Core rev: 63732c7accf802aab106a85d7d3852a689d9beaf)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Khem Raj
2023-12-10 12:25:48 -08:00
committed by Richard Purdie
parent 86a377ebe7
commit ad645dc8b2
2 changed files with 39 additions and 0 deletions

View File

@@ -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

View File

@@ -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"