From cbf66767ea6092cd1a90be82a00321e723fc2a88 Mon Sep 17 00:00:00 2001 From: Emil Renner Berthing Date: Mon, 19 Aug 2013 17:22:40 +0200 Subject: io: don't open files with O_NONBLOCK --- lem/io/core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lem/io/core.c b/lem/io/core.c index 168b18e..f600879 100644 --- a/lem/io/core.c +++ b/lem/io/core.c @@ -130,7 +130,7 @@ io_open_work(struct lem_async *a) #ifdef O_CLOEXEC | O_CLOEXEC #endif - | O_NONBLOCK, o->fd >= 0 ? o->fd : + , o->fd >= 0 ? o->fd : S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); if (fd < 0) { o->flags = -errno; @@ -157,6 +157,10 @@ io_open_work(struct lem_async *a) case S_IFCHR: case S_IFIFO: o->flags = 1; + if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) { + o->flags = -errno; + close(fd); + } break; default: -- cgit v1.2.1