]> git.feebdaed.xyz Git - 0xmirror/gcc.git/commitdiff
a68: fix a68_file_size
authorMohammad-Reza Nabipoor <mnabipoor@gnu.org>
Sat, 20 Dec 2025 21:40:03 +0000 (22:40 +0100)
committerJose E. Marchesi <jose.marchesi@oracle.com>
Mon, 22 Dec 2025 12:54:01 +0000 (13:54 +0100)
Fix description of function, and invocation of lseek.

Signed-off-by: Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
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.

gcc/algol68/a68-parser-scanner.cc

index aa67fb8d09c5e0845efedd1abdd55a8c08afd244..94647d528829c19a1c9ed4b80a94d654a5893b1b 100644 (file)
@@ -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;