btrfs-progs: Fix a compile fail by strndup in RHEL5 env
PATCH 1/3 btrfs-progs: Fix a compile fail by strndup in RHEL5 env
From: Zhao Lei <[email protected]>
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 errorsbtrfs-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 errorsbtrfs.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.
--- btrfs-list.c | 1 + btrfs.c | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-)
btrfs-list.c +1 -0
@@ -16,6 +16,7 @@* Boston, MA 021110-1307, USA. */ +#define _GNU_SOURCE#ifndef __CHECKER__#include <sys/ioctl.h> #include <sys/mount.h>
btrfs.c +1 -1
@@ -14,7 +14,7 @@* Boston, MA 021110-1307, USA. */ - +#define _GNU_SOURCE#include <stdio.h> #include <stdlib.h> #include <string.h>
Signature · 1 line
1.6.5.2