From d6343a0bf74d25973c5ed170b8e037b42bd08a7f Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 27 Dec 2022 08:51:55 +0100 Subject: grt-files_operations: allow last line without EOL --- src/grt/grt-files_operations.adb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') 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. -- cgit v1.2.3