I got build failing as below:
cc1: warnings being treated as errors
gdhcp/client.c: In function ‘alloc_dhcp_option’:
gdhcp/client.c:1455: error: implicit declaration of function ‘strnlen’

define _GNU_SOURCE fixes this problem.

Here add -D_GNU_SOURCE in Makefile instead of source code file.

Signed-off-by: Yang Ruirui <[email protected]>
---
 Makefile.am        |    1 +
 src/log.c          |    1 -
 src/stats.c        |    1 -
 tools/stats-tool.c |    1 -
 4 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 08260c2..0899296 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -102,6 +102,7 @@ endif
 AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @CAPNG_CFLAGS@ @XTABLES_CFLAGS@ \
                                @NETLINK_CFLAGS@ @GNUTLS_CFLAGS@ \
                                $(builtin_cflags) \
+                               -D_GNU_SOURCE \
                                -DCONNMAN_PLUGIN_BUILTIN \
                                -DSTATEDIR=\""$(statedir)"\" \
                                -DPLUGINDIR=\""$(build_plugindir)"\" \
diff --git a/src/log.c b/src/log.c
index eb480b4..90b63ac 100644
--- a/src/log.c
+++ b/src/log.c
@@ -23,7 +23,6 @@
 #include <config.h>
 #endif
-#define _GNU_SOURCE
 #include <stdarg.h>
 #include <syslog.h>
 #include <stdlib.h>
diff --git a/src/stats.c b/src/stats.c
index 0dc45f0..867f8bd 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -23,7 +23,6 @@
 #include <config.h>
 #endif
-#define _GNU_SOURCE
 #include <sys/mman.h>
 #include <sys/types.h>
 #include <sys/stat.h>
diff --git a/tools/stats-tool.c b/tools/stats-tool.c
index cd48806..995e86e 100644
--- a/tools/stats-tool.c
+++ b/tools/stats-tool.c
@@ -22,7 +22,6 @@
 #include <config.h>
 #endif
-#define _GNU_SOURCE
 #include <sys/mman.h>
 #include <sys/types.h>
 #include <sys/stat.h>
--
1.6.4

--
Thanks
Yang Ruirui
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to