From: Zhao Lei Date: Thu, 9 Sep 2010 05:49:14 +0000 (+0800) Subject: fix a compile fail by strndup in RHEL5 env X-Git-Tag: upstream/0.20.rc1~149 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6c94ed24794d5a44a2ab4cde652e80eba05ade7a;p=platform%2Fupstream%2Fbtrfs-progs.git fix a compile fail by strndup in RHEL5 env When we compile btrfs-progs in RHEL5(with default gcc 4.1.2 and glibc-2.5-18), we can get following error: cc1: warnings being treated as errors btrfs-list.c: In function 'ino_resolve': btrfs-list.c:511: warning: implicit declaration of function 'strndup' btrfs-list.c:511: warning: incompatible implicit declaration of built-in function 'strndup' make: *** [btrfs-list.o] Error 1 ... cc1: warnings being treated as errors btrfs.c: In function 'split_command': btrfs.c:168: warning: implicit declaration of function 'strndup' btrfs.c:168: warning: incompatible implicit declaration of built-in function 'strndup' make: *** [btrfs-list.o] Error 1 We can add _GNU_SOURCE definition according man strndup. Signed-off-by: Zhao Lei Signed-off-by: Miao Xie --- diff --git a/btrfs-list.c b/btrfs-list.c index 7741705..9dedb5d 100644 --- a/btrfs-list.c +++ b/btrfs-list.c @@ -16,6 +16,7 @@ * Boston, MA 021110-1307, USA. */ +#define _GNU_SOURCE #ifndef __CHECKER__ #include #include diff --git a/btrfs.c b/btrfs.c index ab5e57f..46314cf 100644 --- a/btrfs.c +++ b/btrfs.c @@ -14,7 +14,7 @@ * Boston, MA 021110-1307, USA. */ - +#define _GNU_SOURCE #include #include #include