From c455e8bc756cc75452385192c52e029d23a8fbaf Mon Sep 17 00:00:00 2001 From: Lai Jiangshan Date: Sat, 26 Mar 2016 18:23:03 +0800 Subject: [PATCH] convert hyper_socketpair() to pipe2 Signed-off-by: Lai Jiangshan --- src/init.c | 2 +- src/util.c | 15 --------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/init.c b/src/init.c index 563afed..ebefe0e 100644 --- a/src/init.c +++ b/src/init.c @@ -424,7 +424,7 @@ static int hyper_setup_container(struct hyper_pod *pod) void *stack; int ret = -1; - if (hyper_socketpair(PF_UNIX, SOCK_STREAM, 0, arg.ctl_pipe) < 0) { + if (pipe2(arg.ctl_pipe, O_CLOEXEC) < 0) { perror("create pipe between hyper init and pod init failed"); goto out; } diff --git a/src/util.c b/src/util.c index cb2fe94..9e7d953 100644 --- a/src/util.c +++ b/src/util.c @@ -430,21 +430,6 @@ int hyper_setfd_nonblock(int fd) return flags; } -int hyper_socketpair(int domain, int type, int protocol, int sv[2]) -{ - if (socketpair(domain, type, protocol, sv) < 0) { - perror("socketpair failed"); - return -1; - } - - if (hyper_setfd_cloexec(sv[0]) < 0 || - hyper_setfd_cloexec(sv[1]) < 0) { - return -1; - } - - return 0; -} - static void hyper_unmount_all(void) { FILE *mtab;