diff options
author | Pascal Obry <obry@adacore.com> | 2007-08-14 10:49:36 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2007-08-14 10:49:36 +0200 |
commit | 2353aeebc50124bc27a9d65d09bc696cca7cd19f (patch) | |
tree | 272fbcb381d730de833c289baa036941d229d14a /gcc | |
parent | b1b1010fb7748a4acfc46f7d1d9e680bc4397904 (diff) | |
download | gcc-2353aeebc50124bc27a9d65d09bc696cca7cd19f.zip gcc-2353aeebc50124bc27a9d65d09bc696cca7cd19f.tar.gz gcc-2353aeebc50124bc27a9d65d09bc696cca7cd19f.tar.bz2 |
s-fileio.adb (Is_Open): Add check for usability of the underlying file stream.
2007-08-14 Pascal Obry <obry@adacore.com>
* s-fileio.adb (Is_Open): Add check for usability of the underlying
file stream.
From-SVN: r127461
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/s-fileio.adb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/ada/s-fileio.adb b/gcc/ada/s-fileio.adb index 3ae5d3d..5607e70 100644 --- a/gcc/ada/s-fileio.adb +++ b/gcc/ada/s-fileio.adb @@ -610,7 +610,13 @@ package body System.File_IO is function Is_Open (File : AFCB_Ptr) return Boolean is begin - return (File /= null); + -- We return True if the file is open, and the underlying file stream is + -- usable. In particular on Windows an application linked with -mwindows + -- option set does not have a console attached. In this case standard + -- files (Current_Output, Current_Error, Current_Input) are not created. + -- We want Is_Open (Current_Output) to return False in this case. + + return File /= null and then fileno (File.Stream) /= -1; end Is_Open; ------------------- |