diff options
author | guenther <guenther@openbsd.org> | 2015-09-13 15:44:47 +0000 |
---|---|---|
committer | guenther <guenther@openbsd.org> | 2015-09-13 15:44:47 +0000 |
commit | 4f68b03b406b747e5b0f54e50f473263f5c5e6d7 (patch) | |
tree | 7641e73d321d4011df7beca3fc5032bb8731c04e | |
parent | Describe tar's -p option correctly (diff) | |
download | wireguard-openbsd-4f68b03b406b747e5b0f54e50f473263f5c5e6d7.tar.xz wireguard-openbsd-4f68b03b406b747e5b0f54e50f473263f5c5e6d7.zip |
More FNDELAY/FIONBIO --> SOCK_NONBLOCK conversions
ok millert@
-rw-r--r-- | usr.sbin/amd/amd/rpc_fwd.c | 18 | ||||
-rw-r--r-- | usr.sbin/portmap/portmap.c | 9 |
2 files changed, 5 insertions, 22 deletions
diff --git a/usr.sbin/amd/amd/rpc_fwd.c b/usr.sbin/amd/amd/rpc_fwd.c index 2cc341c2cb2..442912b1d36 100644 --- a/usr.sbin/amd/amd/rpc_fwd.c +++ b/usr.sbin/amd/amd/rpc_fwd.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)rpc_fwd.c 8.1 (Berkeley) 6/6/93 - * $Id: rpc_fwd.c,v 1.9 2014/10/26 03:28:41 guenther Exp $ + * $Id: rpc_fwd.c,v 1.10 2015/09/13 15:44:47 guenther Exp $ */ /* @@ -41,12 +41,6 @@ #include "am.h" #include <sys/ioctl.h> -#ifndef F_SETFL -#include <fcntl.h> -#endif /* F_SETFL */ -#ifndef FNDELAY -#include <sys/file.h> -#endif /* FNDELAY */ /* * Note that the ID field in the external packet is only @@ -164,12 +158,10 @@ fwd_free(rpc_forward *p) */ int fwd_init() { - int on = 1; - /* * Create ping socket */ - fwd_sock = socket(AF_INET, SOCK_DGRAM, 0); + fwd_sock = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0); if (fwd_sock < 0) { plog(XLOG_ERROR, "Unable to create RPC forwarding socket: %m"); return errno; @@ -181,12 +173,6 @@ int fwd_init() if (bind_resv_port(fwd_sock, (unsigned short *) 0) < 0) plog(XLOG_ERROR, "can't bind privileged port"); - if (fcntl(fwd_sock, F_SETFL, FNDELAY) < 0 && - ioctl(fwd_sock, FIONBIO, &on) < 0) { - plog(XLOG_ERROR, "Can't set non-block on forwarding socket: %m"); - return errno; - } - return 0; } diff --git a/usr.sbin/portmap/portmap.c b/usr.sbin/portmap/portmap.c index 82918c3bded..c5bf395eb3b 100644 --- a/usr.sbin/portmap/portmap.c +++ b/usr.sbin/portmap/portmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: portmap.c,v 1.44 2015/09/13 14:57:33 guenther Exp $ */ +/* $OpenBSD: portmap.c,v 1.45 2015/09/13 15:44:47 guenther Exp $ */ /*- * Copyright (c) 1996, 1997 Theo de Raadt (OpenBSD). All rights reserved. @@ -67,7 +67,6 @@ #include <sys/types.h> #include <sys/socket.h> -#include <sys/ioctl.h> #include <sys/wait.h> #include <sys/resource.h> @@ -578,7 +577,7 @@ callit(struct svc_req *rqstp, SVCXPRT *xprt) u_short port; struct sockaddr_in me; pid_t pid; - int so = -1, dontblock = 1; + int so = -1; CLIENT *client; struct authunix_parms *au = (struct authunix_parms *)rqstp->rq_clntcred; struct timeval timeout; @@ -610,11 +609,9 @@ callit(struct svc_req *rqstp, SVCXPRT *xprt) me.sin_port = htons(port); /* Avoid implicit binding to reserved port by clntudp_create() */ - so = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + so = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, IPPROTO_UDP); if (so == -1) exit(1); - if (ioctl(so, FIONBIO, &dontblock) == -1) - exit(1); client = clntudp_create(&me, a.rmt_prog, a.rmt_vers, timeout, &so); if (client != NULL) { |