From: Stéphane Graber Date: Wed, 15 Jan 2014 23:29:57 +0000 (-0500) Subject: Add local definition of sethostname to lxc_unshare X-Git-Tag: lxc-1.0.0.beta2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a401679393f160322820efa683197f8d589ccc9;p=thirdparty%2Flxc.git Add local definition of sethostname to lxc_unshare sethostname doesn't exist on bionic, so copy/paste the definition of it we have in conf.c Signed-off-by: Stéphane Graber --- diff --git a/src/lxc/lxc_unshare.c b/src/lxc/lxc_unshare.c index 946cdaee9..792bfd9ae 100644 --- a/src/lxc/lxc_unshare.c +++ b/src/lxc/lxc_unshare.c @@ -23,26 +23,41 @@ #define _GNU_SOURCE #include #undef _GNU_SOURCE -#include -#include -#include +#include #include -#include +#include +#include +#include #include -#include +#include +#include +#include +#include #include #include -#include -#include -#include +#include #include "caps.h" +#include "cgroup.h" +#include "config.h" +#include "error.h" #include "log.h" #include "namespace.h" #include "network.h" #include "utils.h" -#include "cgroup.h" -#include "error.h" + +/* Define sethostname() if missing from the C library */ +#ifndef HAVE_SETHOSTNAME +static int sethostname(const char * name, size_t len) +{ +#ifdef __NR_sethostname +return syscall(__NR_sethostname, name, len); +#else +errno = ENOSYS; +return -1; +#endif +} +#endif lxc_log_define(lxc_unshare_ui, lxc);