diff options
Diffstat (limited to 'gcc/ada/s-fileio.adb')
-rw-r--r-- | gcc/ada/s-fileio.adb | 16 |
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; |