Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support POSIX basename() from musl libc
Musl libc removed the definition of the basename() function from string.h and only provides it in libgen.h as the POSIX stanard defines it. This change fixes compilation with musl libc 1.2.5. ```` build_dir/target-mips_24kc_musl/tini-0.19.0/src/tini.c:227:36: error: implicit declaration of function 'basename' [-Wimplicit-function-declaration] 227 | fprintf(file, "%s (%s)\n", basename(name), TINI_VERSION_STRING); build_dir/target-mips_24kc_musl/tini-0.19.0/src/tini.c:227:25: error: format '%s' expects argument of type 'char *', but argument 3 has type 'int' [-Werror=format=] 227 | fprintf(file, "%s (%s)\n", basename(name), TINI_VERSION_STRING); | ~^ ~~~~~~~~~~~~~~ | | | | char * int | %d ```` basename() modifies the input string, copy it first with strdup(), If strdup() returns NULL the code will handle it. Signed-off-by: Hauke Mehrtens <[email protected]>
- Loading branch information