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: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent 31a1209d
......@@ -23,26 +23,41 @@
#define _GNU_SOURCE
#include <stdio.h>
#undef _GNU_SOURCE
#include <stdlib.h>
#include <unistd.h>
#include <libgen.h>
#include <errno.h>
#include <getopt.h>
#include <string.h>
#include <libgen.h>
#include <netinet/in.h>
#include <pwd.h>
#include <signal.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <pwd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment