summaryrefslogtreecommitdiff
path: root/gcc/ada/s-fileio.adb
diff options
context:
space:
mode:
authorsam <sam@138bc75d-0d04-0410-961f-82ee72b054a4>2008-02-27 12:12:14 +0000
committersam <sam@138bc75d-0d04-0410-961f-82ee72b054a4>2008-02-27 12:12:14 +0000
commit04b1f6d3f4537225834237a1c5018f0bcaa87d6a (patch)
treedea6ecdd948269cf4c4c4ca2fd972c247c37c153 /gcc/ada/s-fileio.adb
parent87f9eef516a3c7de69746d5effa92ec486480d66 (diff)
downloadgcc-04b1f6d3f4537225834237a1c5018f0bcaa87d6a.tar.gz
gcc/ada/
PR ada/22255 * s-fileio.adb (Reset): Do not raise Use_Error if mode isn't changed. gcc/testsuite/ PR ada/22255 * gnat.dg/test_direct_io.adb: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132708 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-fileio.adb')
-rw-r--r--gcc/ada/s-fileio.adb16
1 files changed, 9 insertions, 7 deletions
diff --git a/gcc/ada/s-fileio.adb b/gcc/ada/s-fileio.adb
index a56877e2ad6..4a8393c00cb 100644
--- a/gcc/ada/s-fileio.adb
+++ b/gcc/ada/s-fileio.adb
@@ -1074,13 +1074,15 @@ package body System.File_IO is
begin
Check_File_Open (File);
- -- Change of mode not allowed for shared file or file with no name
- -- or file that is not a regular file, or for a system file.
-
- if File.Shared_Status = Yes
- or else File.Name'Length <= 1
- or else File.Is_System_File
- or else not File.Is_Regular_File
+ -- Change of mode not allowed for shared file or file with no name or
+ -- file that is not a regular file, or for a system file. Note that we
+ -- allow the "change" of mode if it is not in fact doing a change.
+
+ if Mode /= File.Mode
+ and then (File.Shared_Status = Yes
+ or else File.Name'Length <= 1
+ or else File.Is_System_File
+ or else not File.Is_Regular_File)
then
raise Use_Error;