rpcd-mod-luci: use standard POSIX header for basename() 6968/head
authorTony Ambardar <itugrok@yahoo.com>
Wed, 6 Mar 2024 08:09:20 +0000 (00:09 -0800)
committerTony Ambardar <itugrok@yahoo.com>
Wed, 6 Mar 2024 08:26:29 +0000 (00:26 -0800)
The musl libc only implements POSIX basename() but provided a GNU header
kludge in <string.h>, which was removed in musl 1.2.5 [1]. Use the standard
<libgen.h> header to avoid compilation errors like:

luci.c: In function 'rpc_luci_parse_network_device_sys':
luci.c:676:53: error: implicit declaration of function 'basename' [-Werror=implicit-function-declaration]
  676 |                 blobmsg_add_string(&blob, "master", basename(link));
      |                                                     ^~~~~~~~
luci.c:676:53: error: passing argument 3 of 'blobmsg_add_string' makes pointer from integer without a cast [-Werror=int-conversion]
  676 |                 blobmsg_add_string(&blob, "master", basename(link));
      |                                                     ^~~~~~~~~~~~~~
      |                                                     |
      |                                                     int
...
cc1: all warnings being treated as errors

Link 1: https://git.musl-libc.org/cgit/musl/log/?qt=grep&q=basename

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
libs/rpcd-mod-luci/Makefile
libs/rpcd-mod-luci/src/luci.c

index ece32a4cc9a465aa30f5e3f032a1546b69d37ba1..c5ed10196e4080884ade7b7706461cc1374380c8 100644 (file)
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=rpcd-mod-luci
-PKG_VERSION:=20230123
+PKG_VERSION:=20240305
 PKG_RELEASE:=1
 PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
 
index e21105d3c6e301049fa5b84dc7f3fbc0572825ca..8b56dce6b7ad3ff11ab6b3228fd0a42b16c1a3e4 100644 (file)
@@ -19,7 +19,7 @@
 #define _GNU_SOURCE
 
 #include <stdio.h>
-#include <string.h>
+#include <libgen.h>
 #include <stdint.h>
 #include <stdlib.h>
 #include <stdarg.h>