Skip to content

Commit

Permalink
trace: use standard POSIX header for basename()
Browse files Browse the repository at this point in the history
The musl libc only implements POSIX basename() but provided a GNU header
kludge in <string.h>, which was removed in musl 1.2.5 [1]. Use the standard
<libgen.h> header to avoid compilation errors like:

trace/trace.c: In function 'main':
trace/trace.c:435:64: error: implicit declaration of function 'basename';
did you mean 'rename'? [-Werror=implicit-function-declaration]
  435 | if (asprintf(&json, "/tmp/%s.%u.json", basename(*argv), child) < 0)
      |                                        ^~~~~~~~
      |                                        rename
cc1: all warnings being treated as errors

Link 1: https://git.musl-libc.org/cgit/musl/log/?qt=grep&q=basename

Signed-off-by: Tony Ambardar <[email protected]>
  • Loading branch information
guidosarducci committed Mar 30, 2024
1 parent 254810d commit 946552a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <libgen.h>
#include <syslog.h>
#include <limits.h>

Expand Down

0 comments on commit 946552a

Please sign in to comment.