~registry/kmod/master

Viewing all changes in revision 1342.

  • Committer: Lucas De Marchi
  • Author(s): Khem Raj
  • Date: 2024-06-10 23:15:39 UTC
  • Revision ID: git-v1:11eb9bc67c319900ab00523997323a97d2d08ad2
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>

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: