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.
---
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 aa67fb8d09c..94647d52882 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;
--
2.52.0