aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2011-01-10 21:45:58 +0200
committerArnold D. Robbins <arnold@skeeve.com>2011-01-10 21:45:58 +0200
commit3e47f16c969b845e323f38f421a6b1da8c20c3a5 (patch)
tree3a2fc4ca6d389ec5b44d319024daa192bd3c71ab /io.c
parent163f4f479b50edfc153e9f2e77bdd9cd070e37ff (diff)
downloadegawk-3e47f16c969b845e323f38f421a6b1da8c20c3a5.tar.gz
egawk-3e47f16c969b845e323f38f421a6b1da8c20c3a5.tar.bz2
egawk-3e47f16c969b845e323f38f421a6b1da8c20c3a5.zip
Fixes for OS/2.
Diffstat (limited to 'io.c')
-rw-r--r--io.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/io.c b/io.c
index 2063c2a9..af15aa02 100644
--- a/io.c
+++ b/io.c
@@ -1502,6 +1502,15 @@ devopen(const char *name, const char *mode)
strictopen:
if (openfd == INVALID_HANDLE)
openfd = open(name, flag, 0666);
+#ifdef __EMX__
+ if (openfd == INVALID_HANDLE && errno == EACCES) {
+ /* on OS/2 directory access via open() is not permitted */
+ struct stat buf;
+
+ if (stat(name, &buf) == 0 && S_ISDIR(buf.st_mode))
+ errno = EISDIR;
+ }
+#endif
if (openfd != INVALID_HANDLE) {
if (os_isdir(openfd)) {
(void) close(openfd); /* don't leak fds */