diff options
Diffstat (limited to 'util/iobuf.c')
-rw-r--r-- | util/iobuf.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/util/iobuf.c b/util/iobuf.c index dc4d019fe..5df2d6975 100644 --- a/util/iobuf.c +++ b/util/iobuf.c @@ -208,7 +208,20 @@ direct_open (const char *fname, const char *mode) else { oflag = O_RDONLY; } +#ifndef __riscos__ return open (fname, oflag, cflag ); +#else + { + struct stat buf; + int rc = stat( fname, &buf ); + + /* Don't allow iobufs on directories */ + if( !rc && S_ISDIR(buf.st_mode) && !S_ISREG(buf.st_mode) ) + return __set_errno( EISDIR ); + else + return open( fname, oflag, cflag ); + } +#endif #endif } |