summaryrefslogtreecommitdiffstats
path: root/src/async.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-04-30 03:32:36 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-04-30 03:32:36 +0200
commit0d0a857c696b653a65c709bbfb11bdaff67369b8 (patch)
treee1c26da2053f8b4801b5120517b16838b7a66c32 /src/async.c
parent4f082c7df3998cdc2cdf9845a62d886d05257cb8 (diff)
downloadfastd-0d0a857c696b653a65c709bbfb11bdaff67369b8.tar
fastd-0d0a857c696b653a65c709bbfb11bdaff67369b8.zip
Use SOCK_NONBLOCK where available
Diffstat (limited to 'src/async.c')
-rw-r--r--src/async.c7
1 files changed, 5 insertions, 2 deletions
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];