From 0d0a857c696b653a65c709bbfb11bdaff67369b8 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 30 Apr 2014 03:32:36 +0200 Subject: Use SOCK_NONBLOCK where available --- src/async.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/async.c') diff --git a/src/async.c b/src/async.c index 28e0b03..21a6930 100644 --- a/src/async.c +++ b/src/async.c @@ -38,10 +38,13 @@ void fastd_async_init(void) { int fds[2]; /* use socketpair with SOCK_DGRAM instead of pipe2 with O_DIRECT to keep this portable */ - if (socketpair(AF_UNIX, SOCK_DGRAM, 0, fds)) + if (socketpair(AF_UNIX, SOCK_DGRAM|SOCK_NONBLOCK, 0, fds)) exit_errno("socketpair"); - fastd_setfl(fds[1], O_NONBLOCK); +#ifdef NO_HAVE_SOCK_NONBLOCK + fastd_setnonblock(fds[0]); + fastd_setnonblock(fds[1]); +#endif ctx.async_rfd = fds[0]; ctx.async_wfd = fds[1]; -- cgit v1.2.3