summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhao Lei <zhaolei@cn.fujitsu.com>2010-09-09 13:49:14 +0800
committerChris Mason <chris.mason@oracle.com>2010-09-23 20:26:49 -0400
commit6c94ed24794d5a44a2ab4cde652e80eba05ade7a (patch)
tree3d698707c71e05e55ce3a1026cae0096bc4b50db
parent2d428975f240caf8faa3a5d86e8c6c56e163f6e3 (diff)
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 <zhaolei@cn.fujitsu.com> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
-rw-r--r--btrfs-list.c1
-rw-r--r--btrfs.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/btrfs-list.c b/btrfs-list.c
index 77417059..9dedb5d2 100644
--- a/btrfs-list.c
+++ b/btrfs-list.c
@@ -16,6 +16,7 @@
* Boston, MA 021110-1307, USA.
*/
+#define _GNU_SOURCE
#ifndef __CHECKER__
#include <sys/ioctl.h>
#include <sys/mount.h>
diff --git a/btrfs.c b/btrfs.c
index ab5e57fe..46314cfe 100644
--- a/btrfs.c
+++ b/btrfs.c
@@ -14,7 +14,7 @@
* Boston, MA 021110-1307, USA.
*/
-
+#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>