os_nodetype: open fd with O_NONBLOCK (#5515)

Closes #5267

Helped-by: oni-link <knil.ino@gmail.com>
This commit is contained in:
Justin M. Keyes
2016-10-21 22:03:01 +02:00
committed by GitHub
parent 82f30bfeda
commit 1ff162c0d9
2 changed files with 39 additions and 10 deletions

View File

@@ -163,8 +163,12 @@ int os_nodetype(const char *name)
// saves us the hassle.
int nodetype = NODE_WRITABLE;
int fd = os_open(name, O_RDONLY, 0);
switch(uv_guess_handle(fd)) {
int fd = os_open(name, O_RDONLY
#ifdef O_NONBLOCK
| O_NONBLOCK
#endif
, 0);
switch (uv_guess_handle(fd)) {
case UV_TTY: // FILE_TYPE_CHAR
nodetype = NODE_WRITABLE;
break;