diff options
author | Emil Renner Berthing <esmil@mailme.dk> | 2013-08-19 17:22:40 +0200 |
---|---|---|
committer | Emil Renner Berthing <esmil@mailme.dk> | 2013-08-19 18:06:48 +0200 |
commit | cbf66767ea6092cd1a90be82a00321e723fc2a88 (patch) | |
tree | 3c3a02c9aaae2d80263f1836a8387cf03e73008c | |
parent | 6f3e5d833d33eecc5d8a11bf083a05de1edc1439 (diff) | |
download | lem-cbf66767ea6092cd1a90be82a00321e723fc2a88.tar.gz lem-cbf66767ea6092cd1a90be82a00321e723fc2a88.tar.xz lem-cbf66767ea6092cd1a90be82a00321e723fc2a88.zip |
io: don't open files with O_NONBLOCK
-rw-r--r-- | lem/io/core.c | 6 |
1 files changed, 5 insertions, 1 deletions
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: |