]> git.ipfire.org Git - thirdparty/kmod.git/commit
Use portable implementation for basename API
authorKhem Raj <raj.khem@gmail.com>
Sun, 10 Dec 2023 01:35:59 +0000 (17:35 -0800)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Mon, 10 Jun 2024 23:15:39 +0000 (18:15 -0500)
commit11eb9bc67c319900ab00523997323a97d2d08ad2
treeaeb97349498d2b7edd4bb02dbacdfda035b23365
parent05828b4a6e9327a63ef94df544a042b5e9ce4fe7
Use portable implementation 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

Implement GNU basename behavior using strchr which is portable across libcs

Fixes
../git/tools/kmod.c:71:19: error: call to undeclared function 'basename'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
71 | "Commands:\n", basename(argv[0]));
| ^

[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7

Suggested-by: Rich Felker
Signed-off-by: Khem Raj <raj.khem@gmail.com>
[ Implement a basename() function in missing.h and ensure we always use
  the right include rather than having a separate gnu_basename() ]
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
configure.ac
shared/missing.h
shared/util.c
shared/util.h
tools/kmod.c