]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
bionic: Define faccessat if missing
authorStéphane Graber <stgraber@ubuntu.com>
Fri, 7 Feb 2014 20:21:24 +0000 (15:21 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Fri, 7 Feb 2014 20:36:06 +0000 (15:36 -0500)
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
configure.ac
src/lxc/lxccontainer.c

index 07cdbf9bb55d45d83f7fa79d2f5a5f318b27df10..b07ac143b28a7c0c3f606addcb03b672ab02e93c 100644 (file)
@@ -515,7 +515,7 @@ AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
 AC_CHECK_HEADERS([sys/signalfd.h pty.h ifaddrs.h sys/capability.h sys/personality.h utmpx.h sys/timerfd.h])
 
 # Check for some syscalls functions
-AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr])
+AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr faccessat])
 
 # Check for some functions
 AC_CHECK_LIB(pthread, main)
index ac92bf10e91cd0780b64039af3c35b05b722a7ac..cbd645d84e6f6413bd37acac5bb285c42ad4b8bc 100644 (file)
@@ -35,6 +35,7 @@
 #include <libgen.h>
 #include <stdint.h>
 #include <grp.h>
+#include <sys/syscall.h>
 
 #include <lxc/lxccontainer.h>
 #include <lxc/version.h>
 
 #define NOT_SUPPORTED_ERROR "the requested function %s is not currently supported with unprivileged containers"
 
+/* Define faccessat() if missing from the C library */
+#ifndef HAVE_FACCESSAT
+static int faccessat(int __fd, const char *__file, int __type, int __flag)
+{
+#ifdef __NR_faccessat
+return syscall(__NR_faccessat, __fd, __file, __type, __flag);
+#else
+errno = ENOSYS;
+return -1;
+#endif
+}
+#endif
+
+
 lxc_log_define(lxc_container, lxc);
 
 static bool file_exists(const char *f)