diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2016-06-07 06:52:50 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2016-06-07 06:52:50 +0000 |
commit | 487894905db1523ad7b5f82279d31d3b396229de (patch) | |
tree | 93a91ed85b8d7243bba6a236c3a3401124ed9d22 /usr.sbin | |
parent | fc1bec0012e30b11a9be1ae1aef1ff600687a83b (diff) |
use io_set_nonblocking() instead of SOCK_NONBLOCKING to reduce delta with
-portable
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/smtpd/smtpd.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c index db665550692..a3d3eeea656 100644 --- a/usr.sbin/smtpd/smtpd.c +++ b/usr.sbin/smtpd/smtpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.c,v 1.277 2016/05/28 21:21:20 eric Exp $ */ +/* $OpenBSD: smtpd.c,v 1.278 2016/06/07 06:52:49 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -789,9 +789,12 @@ start_child(int save_argc, char **save_argv, char *rexec) if (save_argc >= SMTPD_MAXARG - 2) fatalx("too many arguments"); - if (socketpair(AF_UNIX, SOCK_STREAM|SOCK_NONBLOCK, PF_UNSPEC, sp) == -1) + if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, sp) == -1) fatal("socketpair"); + io_set_nonblocking(sp[0]); + io_set_nonblocking(sp[1]); + switch (pid = fork()) { case -1: fatal("%s: fork", save_argv[0]); @@ -830,9 +833,12 @@ setup_peers(struct mproc *a, struct mproc *b) { int sp[2]; - if (socketpair(AF_UNIX, SOCK_STREAM|SOCK_NONBLOCK, PF_UNSPEC, sp) == -1) + if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, sp) == -1) fatal("socketpair"); + io_set_nonblocking(sp[0]); + io_set_nonblocking(sp[1]); + if (imsg_compose(&a->imsgbuf, IMSG_SETUP_PEER, b->proc, b->pid, sp[0], NULL, 0) == -1) fatal("imsg_compose"); |