diff options
author | 2016-08-08 16:52:15 +0000 | |
---|---|---|
committer | 2016-08-08 16:52:15 +0000 | |
commit | 5611b0c10afa85df4d0017d36b2198bc610967ae (patch) | |
tree | 9170fe9836cca0a57f48ae8982fcbcef5cbe0310 /usr.sbin/switchd/switchd.c | |
parent | Handle imsg_read() EAGAIN like the man page code example. (diff) | |
download | wireguard-openbsd-5611b0c10afa85df4d0017d36b2198bc610967ae.tar.xz wireguard-openbsd-5611b0c10afa85df4d0017d36b2198bc610967ae.zip |
Create socket with SOCK_NONBLOCK instead of using fcntl() without the
proper flag handling.
ok reyk@
Diffstat (limited to 'usr.sbin/switchd/switchd.c')
-rw-r--r-- | usr.sbin/switchd/switchd.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.sbin/switchd/switchd.c b/usr.sbin/switchd/switchd.c index 902e9793bef..b3ef9127db5 100644 --- a/usr.sbin/switchd/switchd.c +++ b/usr.sbin/switchd/switchd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: switchd.c,v 1.6 2016/07/22 09:31:33 reyk Exp $ */ +/* $OpenBSD: switchd.c,v 1.7 2016/08/08 16:52:15 rzalamena Exp $ */ /* * Copyright (c) 2013-2016 Reyk Floeter <reyk@openbsd.org> @@ -217,7 +217,8 @@ switchd_socket(struct sockaddr *sock, int reuseport) int s = -1, val; struct linger lng; - if ((s = socket(sock->sa_family, SOCK_STREAM, IPPROTO_TCP)) == -1) + if ((s = socket(sock->sa_family, SOCK_STREAM | SOCK_NONBLOCK, + IPPROTO_TCP)) == -1) goto bad; /* @@ -232,8 +233,6 @@ switchd_socket(struct sockaddr *sock, int reuseport) sizeof(int)) == -1) goto bad; } - if (fcntl(s, F_SETFL, O_NONBLOCK) == -1) - goto bad; /* * TCP options |