From: Anton Berezin Date: Thu, 29 Oct 1998 14:48:54 +0000 (+0100) Subject: tweaked version of suggested patch X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2293b0e962ceeb5ca803801ee7e7f632513f6ebb;p=p5sagit%2Fp5-mst-13.2.git tweaked version of suggested patch Message-ID: <86yapzv5q1.fsf@lion.plab.ku.dk> Subject: [PATCH 5.005_52] One more problem with win32_stat and MSVC p4raw-id: //depot/perl@2147 --- diff --git a/win32/win32.c b/win32/win32.c index 5f7d487..53c9713 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -911,8 +911,17 @@ win32_stat(const char *path, struct stat *buffer) return 0; } } -#ifdef __BORLANDC__ else { + if (l == 3 && path[l-2] == ':' + && (path[l-1] == '\\' || path[l-1] == '/')) + { + /* The drive can be inaccessible, some _stat()s are buggy */ + if (!GetVolumeInformation(path,NULL,0,NULL,NULL,NULL,NULL,0)) { + errno = ENOENT; + return -1; + } + } +#ifdef __BORLANDC__ if (S_ISDIR(buffer->st_mode)) buffer->st_mode |= S_IWRITE | S_IEXEC; else if (S_ISREG(buffer->st_mode)) { @@ -929,8 +938,8 @@ win32_stat(const char *path, struct stat *buffer) else buffer->st_mode &= ~S_IEXEC; } - } #endif + } return res; }