trace: use standard POSIX header for basename() master
authorTony Ambardar <itugrok@yahoo.com>
Wed, 6 Mar 2024 00:27:42 +0000 (16:27 -0800)
committerTony Ambardar <itugrok@yahoo.com>
Sat, 30 Mar 2024 21:30:41 +0000 (14:30 -0700)
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 <itugrok@yahoo.com>
trace/trace.c

index 6fd321f0f339c897f2a11d57f36ddaeb8a6f0daf..e257d89c00c891b0ee8b9836bab4d1ae73dd8707 100644 (file)
@@ -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>