Fix build issue with nat/linux-namespaces.c.

* nat/linux-namespaces.c (setns): Rename from this ...
	(do_setns): ... to this.  Support calling setns if it exists.
	(mnsh_handle_setns): Call do_setns.
This commit is contained in:
Peter Bergner 2015-07-14 10:46:16 -05:00
parent 8a643cc36c
commit 99fe86f799
2 changed files with 12 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2015-07-14 Peter Bergner <bergner@vnet.ibm.com>
* nat/linux-namespaces.c (setns): Rename from this ...
(do_setns): ... to this. Support calling setns if it exists.
(mnsh_handle_setns): Call do_setns.
2015-07-13 Yao Qi <yao.qi@linaro.org> 2015-07-13 Yao Qi <yao.qi@linaro.org>
* exec.c (exec_file_attach): Add period at the end of error * exec.c (exec_file_attach): Add period at the end of error

View File

@ -34,18 +34,18 @@ int debug_linux_namespaces;
/* Handle systems without setns. */ /* Handle systems without setns. */
#ifndef HAVE_SETNS static inline int
static int do_setns (int fd, int nstype)
setns (int fd, int nstype)
{ {
#ifdef __NR_setns #ifdef HAVE_SETNS
return setns (fd, nstype);
#elif defined __NR_setns
return syscall (__NR_setns, fd, nstype); return syscall (__NR_setns, fd, nstype);
#else #else
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
#endif #endif
} }
#endif
/* Handle systems without MSG_CMSG_CLOEXEC. */ /* Handle systems without MSG_CMSG_CLOEXEC. */
@ -495,7 +495,7 @@ mnsh_recv_message (int sock, enum mnsh_msg_type *type,
static ssize_t static ssize_t
mnsh_handle_setns (int sock, int fd, int nstype) mnsh_handle_setns (int sock, int fd, int nstype)
{ {
int result = setns (fd, nstype); int result = do_setns (fd, nstype);
return mnsh_return_int (sock, result, errno); return mnsh_return_int (sock, result, errno);
} }