From: Serge Hallyn Date: Fri, 22 Aug 2014 21:23:56 +0000 (-0500) Subject: statvfs: do nothing if statvfs does not exist (android/bionic) X-Git-Tag: lxc-1.0.6~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4791b80e2fe63c6eb8f40eda0d3f58ec24dcc486;p=thirdparty%2Flxc.git statvfs: do nothing if statvfs does not exist (android/bionic) If statvfs does not exist, then don't recalculate mount flags at remount. If someone does need this, they could replace the code (only if !HAVE_STATVFS) with code parsing /proc/self/mountinfo (which exists in the recent git history) Signed-off-by: Serge Hallyn Acked-by: Stéphane Graber --- diff --git a/configure.ac b/configure.ac index 080ee84de..9ee6fb00b 100644 --- a/configure.ac +++ b/configure.ac @@ -538,6 +538,7 @@ AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr faccessat]) # Check for some functions AC_CHECK_LIB(pthread, main) AC_CHECK_FUNCS(pthread_atfork) +AC_CHECK_FUNCS(statvfs) AC_CHECK_LIB(util, openpty) AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent utmpxname]) AC_CHECK_FUNCS([getline], diff --git a/src/lxc/conf.c b/src/lxc/conf.c index b10860615..573452c50 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -36,7 +36,9 @@ #include #include #include +#ifdef HAVE_STATVFS #include +#endif #if HAVE_PTY_H #include @@ -693,6 +695,7 @@ int pin_rootfs(const char *rootfs) static unsigned long add_required_remount_flags(const char *s, const char *d, unsigned long flags) { +#ifdef HAVE_STATVFS struct statvfs sb; unsigned long required_flags = 0; @@ -717,6 +720,9 @@ static unsigned long add_required_remount_flags(const char *s, const char *d, required_flags |= MS_NOEXEC; return flags | required_flags; +#else + return flags; +#endif } static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_handler *handler) @@ -1935,7 +1941,9 @@ static int mount_entry(const char *fsname, const char *target, const char *fstype, unsigned long mountflags, const char *data, int optional) { +#ifdef HAVE_STATVFS struct statvfs sb; +#endif if (mount(fsname, target, fstype, mountflags & ~MS_REMOUNT, data)) { if (optional) { @@ -1953,6 +1961,7 @@ static int mount_entry(const char *fsname, const char *target, DEBUG("remounting %s on %s to respect bind or remount options", fsname ? fsname : "(none)", target ? target : "(none)"); +#ifdef HAVE_STATVFS if (statvfs(fsname, &sb) == 0) { unsigned long required_flags = 0; if (sb.f_flag & MS_NOSUID) @@ -1978,6 +1987,7 @@ static int mount_entry(const char *fsname, const char *target, } mountflags |= required_flags; } +#endif if (mount(fsname, target, fstype, mountflags | MS_REMOUNT, data)) { @@ -1994,7 +2004,9 @@ static int mount_entry(const char *fsname, const char *target, } } +#ifdef HAVE_STATVFS skipremount: +#endif DEBUG("mounted '%s' on '%s', type '%s'", fsname, target, fstype); return 0;