From acf6b7ab30dceb969bf30ab966ea22acdd06aca6 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Wed, 27 Feb 2008 12:12:14 +0000 Subject: re PR ada/22255 (Reset on shared file causes Use_Error.) 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. From-SVN: r132708 --- gcc/ada/s-fileio.adb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'gcc/ada/s-fileio.adb') diff --git a/gcc/ada/s-fileio.adb b/gcc/ada/s-fileio.adb index a56877e..4a8393c 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; -- cgit v1.1