summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ldapd/ldapd.c
diff options
context:
space:
mode:
authorjmatthew <jmatthew@openbsd.org>2015-11-02 06:32:51 +0000
committerjmatthew <jmatthew@openbsd.org>2015-11-02 06:32:51 +0000
commit576ea306f407aa35fb8c824f0219cd945bd2562c (patch)
treecb7b13dd6d01abc5a69b1b24e084d413a6b5bab0 /usr.sbin/ldapd/ldapd.c
parentFix typo: s/DT_JUMPREL/DT_JMPREL/ (diff)
downloadwireguard-openbsd-576ea306f407aa35fb8c824f0219cd945bd2562c.tar.xz
wireguard-openbsd-576ea306f407aa35fb8c824f0219cd945bd2562c.zip
use SOCK_NONBLOCK instead of fcntl
ok dlg@
Diffstat (limited to 'usr.sbin/ldapd/ldapd.c')
-rw-r--r--usr.sbin/ldapd/ldapd.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/usr.sbin/ldapd/ldapd.c b/usr.sbin/ldapd/ldapd.c
index 2df5cf5a2b7..0805a9519a0 100644
--- a/usr.sbin/ldapd/ldapd.c
+++ b/usr.sbin/ldapd/ldapd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldapd.c,v 1.13 2015/11/02 04:48:43 jmatthew Exp $ */
+/* $OpenBSD: ldapd.c,v 1.14 2015/11/02 06:32:51 jmatthew Exp $ */
/*
* Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se>
@@ -99,18 +99,6 @@ ldapd_sigchld_handler(int sig, short why, void *data)
}
}
-/* set socket non-blocking */
-void
-fd_nonblock(int fd)
-{
- int flags = fcntl(fd, F_GETFL, 0);
- int rc = fcntl(fd, F_SETFL, flags | O_NONBLOCK);
- if (rc == -1) {
- log_warn("failed to set fd %d non-blocking", fd);
- }
-}
-
-
int
main(int argc, char *argv[])
{
@@ -194,12 +182,10 @@ main(int argc, char *argv[])
log_init(debug);
log_info("startup");
- if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pipe_parent2ldap) != 0)
+ if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, PF_UNSPEC,
+ pipe_parent2ldap) != 0)
fatal("socketpair");
- fd_nonblock(pipe_parent2ldap[0]);
- fd_nonblock(pipe_parent2ldap[1]);
-
ldape_pid = ldape(pw, csockpath, pipe_parent2ldap);
setproctitle("auth");