summaryrefslogtreecommitdiff
path: root/sbin/iked/control.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/iked/control.c')
-rw-r--r--sbin/iked/control.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/sbin/iked/control.c b/sbin/iked/control.c
index 39e82102fb9..e08a2b9a666 100644
--- a/sbin/iked/control.c
+++ b/sbin/iked/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.19 2015/10/22 15:55:18 reyk Exp $ */
+/* $OpenBSD: control.c,v 1.20 2015/11/23 19:28:33 reyk Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -83,7 +83,7 @@ control_init(struct privsep *ps, struct control_sock *cs)
if (cs->cs_name == NULL)
return (0);
- if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
+ if ((fd = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0)) == -1) {
log_warn("%s: socket", __func__);
return (-1);
}
@@ -126,7 +126,6 @@ control_init(struct privsep *ps, struct control_sock *cs)
return (-1);
}
- socket_set_blockmode(fd, BM_NONBLOCK);
cs->cs_fd = fd;
cs->cs_env = env;
@@ -177,8 +176,8 @@ control_accept(int listenfd, short event, void *arg)
return;
len = sizeof(sun);
- if ((connfd = accept(listenfd,
- (struct sockaddr *)&sun, &len)) == -1) {
+ if ((connfd = accept4(listenfd,
+ (struct sockaddr *)&sun, &len, SOCK_NONBLOCK)) == -1) {
/*
* Pause accept if we are out of file descriptors, or
* libevent will haunt us here too.
@@ -194,8 +193,6 @@ control_accept(int listenfd, short event, void *arg)
return;
}
- socket_set_blockmode(connfd, BM_NONBLOCK);
-
if ((c = calloc(1, sizeof(struct ctl_conn))) == NULL) {
log_warn("%s", __func__);
close(connfd);