aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'file.c')
-rw-r--r--file.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/file.c b/file.c
index b2ad989df6..784b003274 100644
--- a/file.c
+++ b/file.c
@@ -5680,13 +5680,17 @@ ruby_is_fd_loadable(int fd)
if (fstat(fd, &st) < 0)
return 0;
-
if (S_ISREG(st.st_mode))
return 1;
- if (!S_ISDIR(st.st_mode))
+
+ if (S_ISFIFO(st.st_mode))
return 1;
- errno = EISDIR;
+ if (S_ISDIR(st.st_mode))
+ errno = EISDIR;
+ else
+ errno = ENXIO;
+
return 0;
#endif
}