rpcd-mod-luci: use standard POSIX header for basename()
authorTony Ambardar <itugrok@yahoo.com>
Wed, 6 Mar 2024 08:09:20 +0000 (00:09 -0800)
committerJo-Philipp Wich <jo@mein.io>
Wed, 13 Mar 2024 08:18:09 +0000 (09:18 +0100)
commit4f2b94f0e0d4dda38e1cd9a761d114bfbacefdbe
tree42ca90107bbd10f0c391c54ecc99cb9ecb28a4e1
parentcd7e519642ecf37d1f20cf4707b1c1f80c89cabf
rpcd-mod-luci: use standard POSIX header for basename()

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>
(cherry picked from commit 8b08b48df99c42918ab443dea29bd42652abed36)
libs/rpcd-mod-luci/Makefile
libs/rpcd-mod-luci/src/luci.c