From 9953f4cee02f2781ee5da2e42bcb837c1a849cb0 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 12 Dec 2013 20:45:59 +0200 Subject: First round of VMS changes. --- vms/vms_misc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'vms/vms_misc.c') diff --git a/vms/vms_misc.c b/vms/vms_misc.c index cd92d7ef..ce190341 100644 --- a/vms/vms_misc.c +++ b/vms/vms_misc.c @@ -118,15 +118,24 @@ vms_open( const char *name, int mode, ... ) result = creat(name, 0, "rfm=stmlf", "rat=cr", "shr=nil", "mbc=32"); } else { struct stat stb; + int stat_result; const char *mbc, *shr = "shr=get", *ctx = "ctx=stm"; - - if (stat((char *)name, &stb) < 0) { /* assume DECnet */ + + stat_result = stat((char *)name, &stb); + if ( stat_result < 0) { /* assume DECnet */ mbc = "mbc=8"; } else { /* ordinary file; allow full sharing iff record format */ mbc = "mbc=32"; if ((stb.st_fab_rfm & 0x0F) < FAB$C_STM) shr = "shr=get,put,upd"; } result = open(name, mode, 0, shr, mbc, "mbf=2"); + if ((stat_result >= 0) && (result < 0) && (errno == ENOENT)) { + /* ENOENT not possible because stat succeeded */ + errno = EMFILE; + if (S_ISDIR(stb.st_mode)) { + errno = EISDIR; /* Bug seen in VMS 8.3 */ + } + } } /* This is only approximate; the ACP -> RMS -> VAXCRTL interface -- cgit v1.2.3