diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-06 09:41:04 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-06 09:41:04 +0000 |
commit | b43911a675b75bc1d7e08b9e47e7354f405fc4c5 (patch) | |
tree | ab863f320e4c16e67c92f3433536eab8625244ff /gcc/ada/s-fileio.adb | |
parent | 18fc86c6dd21d64aeed18c7efc2bc7791b4b5846 (diff) | |
download | gcc-b43911a675b75bc1d7e08b9e47e7354f405fc4c5.tar.gz |
2008-08-06 Thomas Quinot <quinot@adacore.com>
* s-fileio.adb (Open): When file open operation fails, raise Name_Error
only when the operating system reports a non-existing file or directory
(ENOENT), otherwise raise Name_Error.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138786 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-fileio.adb')
-rw-r--r-- | gcc/ada/s-fileio.adb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/ada/s-fileio.adb b/gcc/ada/s-fileio.adb index 41419b5f793..79b718eadce 100644 --- a/gcc/ada/s-fileio.adb +++ b/gcc/ada/s-fileio.adb @@ -33,10 +33,13 @@ with Ada.Finalization; use Ada.Finalization; with Ada.IO_Exceptions; use Ada.IO_Exceptions; +with Interfaces.C; with Interfaces.C_Streams; use Interfaces.C_Streams; with System.CRTL; with System.Case_Util; use System.Case_Util; +with System.OS_Constants; +with System.OS_Lib; with System.Soft_Links; with Ada.Unchecked_Deallocation; @@ -47,6 +50,7 @@ package body System.File_IO is package SSL renames System.Soft_Links; + use type Interfaces.C.int; use type System.CRTL.size_t; ---------------------- @@ -984,7 +988,11 @@ package body System.File_IO is Stream := fopen (Namestr'Address, Fopstr'Address, Encoding); if Stream = NULL_Stream then - if not Tempfile and then file_exists (Namestr'Address) = 0 then + -- Raise Name_Error if trying to open a non-existent file. + -- Otherwise raise Use_Error. Should we raise Device_Error for + -- ENOSPC??? + + if System.OS_Lib.Errno = System.OS_Constants.ENOENT then raise Name_Error; else raise Use_Error; |