Commit Graph

87 Commits

Author SHA1 Message Date
Lucas De Marchi
63302cf655 util: Promote path_is_absolute() to header
This is a trivial function that can be used elsewhere. There's no point
in keeping the assert if we are going to crash in the very next
instruction. Rather add the relevant attribute and drop the assert.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/243
2024-11-20 22:25:30 -06:00
Tobias Stoeckmann
088e2e2d69 libkmod: Fix typo in comment
The word practise only exists in British English and is a verb.
Switch to practice and adjust style.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Link: https://github.com/kmod-project/kmod/pull/241
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-11-19 00:23:32 -06:00
Lucas De Marchi
c6b4652dd9 Remove scratchbuf implementation
All its unique features have been ported to strbuf and users converted.
Nuke it.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/239
2024-11-17 15:35:14 -06:00
Lucas De Marchi
14ce34d755 strbuf: Add strbuf_shrink_to()
Useful when working with paths on a loop and resetting to a base path
component on every loop iteration.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/239
2024-11-17 15:35:13 -06:00
Lucas De Marchi
5706fb7d61 strbuf: Add strbuf_used()
So users don't feel tempted to look at inside the strbuf. Just add a
function for it and proper tests.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/239
2024-11-17 15:35:13 -06:00
Lucas De Marchi
68c0b9fb8c strbuf: Add strbuf_pushmem()
Wrapper for memcpy(). It's similar to strbuf_pushchars(), but push any
char, including the NUL byte, relying on the size passed as argument.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/239
2024-11-17 15:35:13 -06:00
Lucas De Marchi
cc2ba0b74a strbuf: Do not append '\0' if not needed
Unconditionally appending '\0' is not a big problem, but that does
trigger the buffer to potentially be re-allocated. Avoid that by
checking the last char is not already NUL.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/239
2024-11-17 15:35:13 -06:00
Lucas De Marchi
952bf223e0 strbuf: Add strbuf_reserve_extra()
To accomplish the same task as scratchbuf_alloc() does: make sure the
buffer has enough space for next operations. One difference is that
ensures **extra** space, not the total space. If needed in future,
a strbuf_reserve(), that resembles C++'s std::vector::reserve(), can be
added on top.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/239
2024-11-17 15:35:13 -06:00
Lucas De Marchi
1e36bfada5 strbuf: Allow to start with stack space
This is the main functionality of the scratchbuf implementation: it
starts with a buffer on stack that covers most of the calls, but also
has a fallback to allocate the buffer if it grows beyond the initial
size.

Port that functionality from scratchbuf to strbuf, so the former can be
eventually removed.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/239
2024-11-17 15:35:13 -06:00
Lucas De Marchi
25f2b2e096 strbuf: Invalidate (only) when stolen
The main for strbuf_steal() to free() on error was to allow the caller
to pass the NULL up the stack with just a return call to
strbuf_steal().

However this is error-prone and surprising that the buffer is still
invalidated on error. Provide an strbuf cleanup attribute that can be
used for the same purpose and make sure that when the string is stolen,
it's set to NULL, so there's no dangling pointer around.

Since we run the  testsuite with AddressSanitizer, a simple test can be
added to make sure the stolen string becomes valid when the attribute is
used.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/239
2024-11-17 15:35:13 -06:00
Lucas De Marchi
b8776806de strbuf: Document strbuf_popchar(s)
Document the behavior for these functions and also clarify why the
testsuite can check the buffer for equality after calling strbuf_str().

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/239
2024-11-17 15:35:13 -06:00
Lucas De Marchi
c83ce183f0 strbuf: Re-use buf_realloc()
Let the realloc happen in only one place, so we can change its behavior
in future.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/239
2024-11-17 15:35:13 -06:00
Lucas De Marchi
b7e2c1eb58 strbuf: Extract realloc
Extract the realloc from the size calculation so it can be shared with
other upcoming callers.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/239
2024-11-17 15:35:13 -06:00
Lucas De Marchi
28ba117fc6 tree-wide: Sprinkle _clang_suppress_alloc_
Add the clang::suppress attribute to places where allocation is done and
that rely on the cleanup attribute. Clang analyzer doesn't handle those
(yet), so keep it from giving us false positive.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/233
2024-11-11 18:11:11 -06:00
Lucas De Marchi
317f89a59a shared: Ignore clang-analyzer on cleanup attribute
When using the cleanup attribute we know we are not leaking that
allocation. Most of the time the assignment is together with the
declaration, so we can simplify additional clang annotations by making
the cleanup attribute imply clang::suppress.

In cases declaration and assignment are not together, provide
_clang_suppress_alloc_ to annotate the code. That is only defined for
clang analyzer.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/233
2024-11-11 18:11:11 -06:00
Lucas De Marchi
f94b5c4c37 shared: Move cleanup attribute
Move to macro.h where other attributes are located. The inline helper
function can also move along as we don't need to keep it separate.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/233
2024-11-11 18:11:11 -06:00
Emil Velikov
ebbca1c240 Revert "testsuite/path: match the full rootpath"
This reverts commit ae0c0c4c89.

The commit reasoning was correct, but did not consider the case where
other third-party files are created. Namely: when generating the code
coverage files.

Thus the gcna files were created in $test_rootdir/$abs_top_builddir
which meant they won't get picked when the coverage info/xml/html files
were created and the statistics reported were quite wrong.

Revert the commit and add an inline comment, so we don't feel tempted to
change it in the future.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/229
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-11-08 11:51:52 -06:00
Tobias Stoeckmann
39e6f0e237 libkmod: Unify READV usages
Do not assign variables which are not even used, but merely exist for
the READV macro to work.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/187
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-10-18 14:00:27 -05:00
Tobias Stoeckmann
8d03b6c7d9 libkmod: Use pread where appropriate
Since we do not want to modify the current position in file, use pread
instead of read + lseek. Removes one lseek call per module, which for
depmod on Arch Linux means 6143 calls.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Link: https://github.com/kmod-project/kmod/pull/189
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-10-18 13:45:23 -05:00
Emil Velikov
944d970f0f Avoid adding zero to a NULL pointer
Adding zero to a NULL pointer is undefined behaviour, which is getting
clarified with C23 (or just after) to match our current usage.

With clang 18, this triggers the undefined behaviour sanitizer so add a
check to stay compliant.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/180
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-10-17 08:28:08 -05:00
Emil Velikov
88c11d28d8 Introduce and use u{add,mul}sz_overflow() helpers
Instead of doing things manually add a few helpers and use them. As a
bonus point, fix the potential overflow in kmod_elf_get_strings().

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/169
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-10-15 12:43:20 -05:00
Emil Velikov
7eba0cd2cb shared: introduce umul{32,64}_overflow() helpers
We'll use them to implement the size_t variant.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/169
[ Fixup commit message for renamed functions ]
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-10-15 12:42:56 -05:00
Emil Velikov
8808f0eeaa shared: introduce uadd32_overflow() helper
We'll use it in the upcoming size_t variant.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/169
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-10-15 12:35:38 -05:00
Emil Velikov
b9019723bd shared: s/addu64_overflow/uadd64_overflow/g
Rename the helper closer to the actual built-in.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/169
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-10-15 12:35:38 -05:00
Emil Velikov
8fa87bf4aa shared: tweak addu64_overflow() #if/else chain
Group the checks as applicable - require the long variant when
sizeof(long) == 8, or the long long one as sizeof(long long) == 8.

Ultimately, fold fallback in the #else path, since it's dead code atm
and seemingly confuses tools such as Coverity.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/169
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-10-15 12:35:38 -05:00
Emil Velikov
cdb6c2d66e shared: add missing stddef.h include
Required for size_t, reported by clang-tidy.

Fixes: 38943b20 ("shared: use size_t for strbuf")
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/172
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-10-08 23:20:00 -05:00
Tobias Stoeckmann
7805c95fbe shared: Fix EOF handling in freadline_wrapped
If a file ends with a backslash without a newline, freadline_wrapped
adds EOF to the actual string.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Link: https://github.com/kmod-project/kmod/pull/159
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-27 23:17:38 -05:00
Emil Velikov
1d0117f86a shared: mass convert with clang-format
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/118
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-24 09:59:20 -05:00
Emil Velikov
ddbc49542c shared: remove no longer used NOFAIL() macro
Closes: https://github.com/kmod-project/kmod/issues/60
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/135
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-17 10:07:48 -05:00
Tobias Stoeckmann
3cc6e5998a shared: Remove fatal macro
The fatal macro was never implemented. Its only user, libkmod-index,
should propagate error condition through errno as good as possible.

Other logging mechanisms are not available without adjusting API
because context is missing.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/123
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-16 22:22:39 -05:00
Emil Velikov
1d20e3e8d6 shared: use _nonnull_() decoration
Use the recently introduced attribute macro.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/114
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-07 10:13:51 -05:00
Emil Velikov
bfea05f534 libkmod: introduce and use _nonnull_() decoration
Introduce a new attribute macro and use it, placing it on the left hand
side of the function return value. This aligns with the attributes style
used in C23.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/114
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-07 10:13:51 -05:00
Emil Velikov
26f2c17b68 shared: use _nonnull_all_ decoration
Use the recently introduced attribute macro.

Note that functions such as memdup() and path_ends_with_kmod_ext() take
the (non-zero) length of their non-null string, thus can be annotated
with this _all_ variant.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/114
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-07 10:13:51 -05:00
Emil Velikov
6141edc7ed libkmod: introduce and use _nonnull_all_ decoration
Introduce a new attribute macro and use it, placing it on the left hand
side of the function return value. This aligns with the attributes style
used in C23.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/114
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-07 10:13:51 -05:00
Lucas De Marchi
2f3be925ef Move _must_check to the left side
Move the attribute to the left hand side since it's clearer and will
help with better formatting when running clang-format.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-07 10:13:51 -05:00
Emil Velikov
13531c2927 shared: add trailing comma for multi-line arrays
... otherwise the upcoming clang-format will try to fold them on single
line, making the end result far from ideal.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/114
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-07 10:13:51 -05:00
Tobias Stoeckmann
38943b2060 shared: use size_t for strbuf
The unsigned datatype could overflow on 64 bit systems with sufficiently
large index files. Switch to size_t just to be safe.

Since the API of strbuf is not exported, this has no side-effect for
libkmod users.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Link: https://github.com/kmod-project/kmod/pull/101
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-06 11:40:22 -05:00
Emil Velikov
b27aa3fb5a shared: use memdup over stdndupa
The stdndupa has a couple of gotchas:
 - allocates memory on stack via alloca(3)... where we pass it a
   user-provided string in at least one instance
 - it's a GNU extension missing on musl and bionic

The mkdir_p() function is not a hot path, so using heap allocation is
perfectly fine. Swap the stdndupa for our local helper memdup.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/92
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-02 08:55:40 -05:00
Emil Velikov
ae0c0c4c89 testsuite/path: match the full rootpath
Our expectation is that the (full) rootpath is present, otherwise we
prepend it ourselves. Drop the ABS_TOP_BUILDDIR instance.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-08-23 13:51:19 -05:00
Emil Velikov
d469acd4d5 build: remove linux/module.h check
We include the header for the UAPI MODULE_INIT_* constants, while we
also provide them locally.

At a glance, at least Arch and Alpine build kmod without the uapi
header, so just drop the check and ifndef guards all together.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-08-23 13:51:19 -05:00
Emil Velikov
e48e07fd4c missing.h: remove be32toh wrapper
As the inline comment says, it is applicable for older distributions
like RHEL 5. The extended support for RHEL 5 ended in 2020 (4 years ago)
so we're safe to drop this.

According to the Alpine build logs - the symbol has been present in musl
for years.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-08-23 13:51:19 -05:00
Emil Velikov
cee455ee78 missing.h: warn on missing __NR_finit_module
Complain (somewhat) loudly if we don't have the syscall number, as the
default cannot work.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-08-23 13:51:19 -05:00
Tobias Stoeckmann
84eff55d4d shared: use proper data types in freadline_wrapped
Do not use signed data types if unsigned arithmetic is expected,
i.e. use size_t if processing sizes and unsigned int for line numbers
due to given API of freadline_wrapped.

This fixes a possible signed integer overflow on 64 bit systems.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/81
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-08-22 16:43:30 -05:00
Tobias Stoeckmann
0c2bd66e6b shared: unify array trim handling
An error during array_realloc is always ignored if the idea
was to save memory by trimming an array.

Move two occurrences of same code into a single function for
easier reviewing.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/68
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-08-16 00:00:26 -05:00
Tobias Stoeckmann
f4b858c704 shared: Add defensive measures to array handling
- Make sure that SIZE_MAX boundaries are never crossed
- Clear pointer address in struct during array_free_array
- Do nothing if array_pop is called with empty array

Also added test case for pop behavior and extended tests with
more checks.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/68
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-08-16 00:00:09 -05:00
Tobias Stoeckmann
6ef3643d0a shared: switch array API to size_t
The position in array_remove_at could be theoretically larger
than unsigned int. Switch to size_t to stay in sync with all
other such arguments in array context.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/68
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-08-16 00:00:00 -05:00
Tobias Stoeckmann
717091acaa Fix typos
Typos found with codespell.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-08-15 23:06:21 -05:00
Lucas De Marchi
d4f659e12a Drop the one line short description on sources
Some are outdated, misleading or just repeat the same thing over and
over. Remove them as they are not needed.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://lore.kernel.org/r/20240723185921.1005569-3-lucas.de.marchi@gmail.com
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-07-26 13:41:56 -05:00
Lucas De Marchi
b5a2cd070d Use SPDX header for license
Drop the lengthy license from each file and just use SPDX like most
projects nowadays. This doesn't have any change to license, just how
they are recorded in each file.

This follows the kernel approach: header files use '/*' for comments
while .c files use '//'. For .m4, use "#".

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://lore.kernel.org/r/20240723185921.1005569-2-lucas.de.marchi@gmail.com
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-07-26 13:41:56 -05:00
Khem Raj
11eb9bc67c 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>
2024-06-10 18:15:39 -05:00