
There is no GNU basename support in MacOS. Use generic POSIX basename defined in libgen.h instead.
Signed-off-by: Keith Mok ek9852@gmail.com --- tools/mkenvimage.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c index f781731..8b49723 100644 --- a/tools/mkenvimage.c +++ b/tools/mkenvimage.c @@ -25,9 +25,6 @@ * MA 02111-1307 USA */
-/* We want the GNU version of basename() */ -#define _GNU_SOURCE - #include <errno.h> #include <fcntl.h> #include <stdio.h> @@ -35,6 +32,7 @@ #include <string.h> #include <unistd.h> #include <compiler.h> +#include <libgen.h> #include <sys/types.h> #include <sys/stat.h>
@@ -85,8 +83,10 @@ int main(int argc, char **argv)
int fp, ep; const char *prg; + char *prog_pathname;
- prg = basename(argv[0]); + prog_pathname = strdup(argv[0]); + prg = basename(prog_pathname);
/* Turn off getopt()'s internal error message */ opterr = 0;