diff options
-rw-r--r-- | src/grt/grt-files_operations.adb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/grt/grt-files_operations.adb b/src/grt/grt-files_operations.adb index f2b408398..097165855 100644 --- a/src/grt/grt-files_operations.adb +++ b/src/grt/grt-files_operations.adb @@ -562,7 +562,10 @@ package body Grt.Files_Operations is for I in 1 .. Len loop C := fgetc (Stream); if C < 0 then - Status := Op_End_Of_File; + -- Return EOF only if no character has been read. + if L = 0 then + Status := Op_End_Of_File; + end if; exit; end if; -- Be nice with DOS files: handle CR/CR+LF/LF. |