1 From 47c3850cddd63cebd9dc48e411963314449118f1 Mon Sep 17 00:00:00 2001
2 From: Khem Raj <raj.khem@gmail.com>
3 Date: Sun, 31 Dec 2023 19:16:35 -0800
4 Subject: [PATCH] mraa: Use posix basename
6 Musl has removed the declaration from string.h [1] which exposes the
7 problem especially with clang-17+ compiler where implicit function
8 declaration is flagged as error. Use posix basename and make a copy of
9 string to operate on to emulate GNU basename behaviour.
11 [1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7
13 Signed-off-by: Khem Raj <raj.khem@gmail.com>
16 1 file changed, 4 insertions(+), 1 deletion(-)
28 @@ -338,9 +339,11 @@ static int
29 mraa_count_iio_devices(const char* path, const struct stat* sb, int flag, struct FTW* ftwb)
31 // we are only interested in files with specific names
32 - if (fnmatch(IIO_DEVICE_WILDCARD, basename(path), 0) == 0) {
33 + char* tmp = strdup(path);
34 + if (fnmatch(IIO_DEVICE_WILDCARD, basename(tmp), 0) == 0) {