linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] btrfs-progs: Fix a compile fail by strndup in RHEL5 env
@ 2010-03-25 12:38 Miao Xie
  0 siblings, 0 replies; only message in thread
From: Miao Xie @ 2010-03-25 12:38 UTC (permalink / raw)
  To: Chris Mason; +Cc: Linux Btrfs

From: Zhao Lei <zhaolei@cn.fujitsu.com>

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>
---
 btrfs-list.c |    1 +
 btrfs.c      |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

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 <sys/ioctl.h>
 #include <sys/mount.h>
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 <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-- 
1.6.5.2



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-03-25 12:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-25 12:38 [PATCH 1/3] btrfs-progs: Fix a compile fail by strndup in RHEL5 env Miao Xie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).