diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-08-01 12:27:49 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-08-01 12:27:49 +0200 |
commit | 47e11d08d66896ebf33e023c1724925ff2a1546e (patch) | |
tree | 4cb0f919732a8780906712f099f44e28f97f78a4 /gcc/ada/adaint.c | |
parent | a3a16b218709b07f98329f42bc805d1c7731f71b (diff) | |
download | gcc-47e11d08d66896ebf33e023c1724925ff2a1546e.zip gcc-47e11d08d66896ebf33e023c1724925ff2a1546e.tar.gz gcc-47e11d08d66896ebf33e023c1724925ff2a1546e.tar.bz2 |
[multiple changes]
2011-08-01 Robert Dewar <dewar@adacore.com>
* atree.ads: Minor comment fix.
* a-stwifi.adb, a-stzfix.adb, a-strfix.adb, a-ztexio.ads, a-textio.ads,
a-witeio.ads, sem_prag.adb: Minor reformatting.
2011-08-01 Doug Rupp <rupp@adacore.com>
* env.c (__gnat_setenv) [VMS]: Force 32bit on item list structure
pointers. Use descrip.h header file for convenience. Add some
comments.
2011-08-01 Robert Dewar <dewar@adacore.com>
* freeze.adb (Freeze_Entity): Call Check_Aspect_At_Freeze_Point
(Freeze_All): Call Check_Aspect_At_End_Of_Declarations
* sem_ch13.ads, sem_ch13.adb (Check_Aspect_At_Freeze_Point):
New procedure.
(Check_Aspect_At_End_Of_Declarations): New procedure
(Analye_Aspect_Specification): Minor changes for above procedures
* sinfo.ads, sinfo.adb (Is_Delayed_Aspect): Now set in aspect
specification node as well.
2011-08-01 Pascal Obry <obry@adacore.com>
* adaint.c (_gnat_stat): GetFilesAttributesEx() would fail on special
Windows files. Use GetFilesAttributes() in this case to check for file
existence instead of returning with an error code.
From-SVN: r177008
Diffstat (limited to 'gcc/ada/adaint.c')
-rw-r--r-- | gcc/ada/adaint.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index dbd76a5..c1e97c6 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -1697,6 +1697,7 @@ __gnat_stat (char *name, GNAT_STRUCT_STAT *statbuf) TCHAR wname [GNAT_MAX_PATH_LEN + 2]; int name_len; BOOL res; + DWORD error; S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2); name_len = _tcslen (wname); @@ -1708,8 +1709,19 @@ __gnat_stat (char *name, GNAT_STRUCT_STAT *statbuf) res = GetFileAttributesEx (wname, GetFileExInfoStandard, &fad); - if (res == FALSE) - switch (GetLastError()) { + if (res == FALSE) { + error = GetLastError(); + + /* Check file existence using GetFileAttributes() which does not fail on + special Windows files like con:, aux:, nul: etc... */ + + if (GetFileAttributes(wname) != INVALID_FILE_ATTRIBUTES) { + /* Just pretend that it is a regular and readable file */ + statbuf->st_mode = S_IFREG | S_IREAD | S_IWRITE; + return 0; + } + + switch (error) { case ERROR_ACCESS_DENIED: case ERROR_SHARING_VIOLATION: case ERROR_LOCK_VIOLATION: @@ -1722,6 +1734,7 @@ __gnat_stat (char *name, GNAT_STRUCT_STAT *statbuf) default: return ENOENT; } + } f2t (&fad.ftCreationTime, &statbuf->st_ctime); f2t (&fad.ftLastWriteTime, &statbuf->st_mtime); |