]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
tools/mkenvimage.c: fix basename(3) usage
authorAndreas Bießmann <andreas.devel@googlemail.com>
Thu, 28 Jun 2012 06:01:58 +0000 (08:01 +0200)
committerWolfgang Denk <wd@denx.de>
Mon, 2 Jul 2012 18:21:49 +0000 (20:21 +0200)
Use the POSIX variant of basename due to BSD systems (e.g. OS X) do not provide
GNU version of basename(3). It is save to use the POSIX variant here cause we do
never use argv[0] later on which may be modified by the basename(3) POSIX
variant.
On systems providing GNU variant the GNU variant should be used since string.h
is included before libgen.h. Therefore let the _GNU_SOURCE as is.

This patch fixes following warning (on OS X):
---8<---
mkenvimage.c: In function ‘main’:
mkenvimage.c:105: warning: implicit declaration of function ‘basename’
mkenvimage.c:105: warning: assignment makes pointer from integer without a cast
--->8---

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
cc: Keith Mok <ek9852@gmail.com>

tools/mkenvimage.c

index bfc4eb636b661affde52e3a1a5422b9b02bc7fc5..55212687e17d0162790002c1c3e5fffbfccb45ca 100644 (file)
@@ -35,6 +35,7 @@
 #include <stdint.h>
 #include <string.h>
 #include <unistd.h>
+#include <libgen.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/mman.h>