Skip to content

Commit

Permalink
include libgen.h for basename API
Browse files Browse the repository at this point in the history
musl has removed the non-prototype declaration of basename from string.h
[1] which now results in build errors with clang-17+ compiler

include libgen.h for using the posix declaration of the funciton.

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
Signed-off-by: Khem Raj <raj.khem@gmail.com>
  • Loading branch information
kraj committed Dec 4, 2023
1 parent 510c8b7 commit 2154f7c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions libkmod/libkmod-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <libgen.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
Expand Down
1 change: 1 addition & 0 deletions shared/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <libgen.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
Expand Down
1 change: 1 addition & 0 deletions testsuite/testsuite.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <libgen.h>
#include <limits.h>
#include <regex.h>
#include <stdarg.h>
Expand Down
1 change: 1 addition & 0 deletions tools/depmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <dirent.h>
#include <errno.h>
#include <getopt.h>
#include <libgen.h>
#include <limits.h>
#include <regex.h>
#include <stdio.h>
Expand Down
1 change: 1 addition & 0 deletions tools/kmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <errno.h>
#include <getopt.h>
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down

0 comments on commit 2154f7c

Please sign in to comment.