[lxc-devel] [lxc/master] bdev: include own getline function in bdev.h

brauner on Github lxc-bot at linuxcontainers.org
Wed Jul 27 16:11:30 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 585 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160727/3091fc26/attachment.bin>
-------------- next part --------------
From 8c2e2e8f5319f5e66ca5920f50e835f3f31a908f Mon Sep 17 00:00:00 2001
From: Christian Brauner <cbrauner at suse.de>
Date: Wed, 27 Jul 2016 18:07:34 +0200
Subject: [PATCH] bdev: include own getline function in bdev.h

Fixes android build error:

bdev/bdev.c: In function 'detect_fs':
bdev/bdev.c:686:2: error: implicit declaration of function 'getline' [-Werror=implicit-function-declaration]
  while (getline(&line, &linelen, f) != -1) {
  ^

Signed-off-by: Christian Brauner <cbrauner at suse.de>
---
 src/lxc/bdev/bdev.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/lxc/bdev/bdev.h b/src/lxc/bdev/bdev.h
index 3f21e84..1ffb590 100644
--- a/src/lxc/bdev/bdev.h
+++ b/src/lxc/bdev/bdev.h
@@ -33,6 +33,13 @@
 
 #include "config.h"
 
+/* Define getline() if missing from the C library */
+#ifndef HAVE_GETLINE
+#ifdef HAVE_FGETLN
+#include <../../include/getline.h>
+#endif
+#endif
+
 /* define constants if the kernel/glibc headers don't define them */
 #ifndef MS_DIRSYNC
 #define MS_DIRSYNC 128


More information about the lxc-devel mailing list