https://gcc.gnu.org/g:74cded0be35aa0437a99a054a664a53fc1057901

commit r16-6327-g74cded0be35aa0437a99a054a664a53fc1057901
Author: Mohammad-Reza Nabipoor <[email protected]>
Date:   Sat Dec 20 22:40:03 2025 +0100

    a68: fix a68_file_size
    
    Fix description of function, and invocation of lseek.
    
    Signed-off-by: Mohammad-Reza Nabipoor <[email protected]>
    
    gcc/algol68/ChangeLog
    
            * a68-parser-scanner.cc (a68_file_size): Fix comment to mention
            it accepts `FILE *' and not file descriptor.
            Fix invocation of `lseek' to correctly revert position of file
            offset to previous one.

Diff:
---
 gcc/algol68/a68-parser-scanner.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/algol68/a68-parser-scanner.cc 
b/gcc/algol68/a68-parser-scanner.cc
index aa67fb8d09c5..94647d528829 100644
--- a/gcc/algol68/a68-parser-scanner.cc
+++ b/gcc/algol68/a68-parser-scanner.cc
@@ -119,7 +119,7 @@ supper_postlude[] = {
     }                                                                  \
   while (0)
 
-/* Get the size of a file given a file descriptor FILE.  In case the size of
+/* Get the size of a file given a stream pointer FILE.  In case the size of
    the file cannot be determined then this function returns -1.  */
 
 ssize_t
@@ -137,7 +137,7 @@ a68_file_size (FILE *file)
     return -1;
   fsize = (ssize_t) off;
 
-  off = lseek (fileno (file), 0, save);
+  off = lseek (fileno (file), save, SEEK_SET);
   if (off == (off_t) -1)
     return -1;

Reply via email to