[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[COMMITTED] pkl-diag: skip detailed location generation for non-seekable
From: |
Mohammad-Reza Nabipoor |
Subject: |
[COMMITTED] pkl-diag: skip detailed location generation for non-seekable inputs |
Date: |
Tue, 9 Apr 2024 18:54:40 +0200 |
2024-04-09 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
* libpoke/pkl-diag.c (pkl_detailed_location): Handle the failure
of `fseeko'.
---
Also cherry-picked in maint/poke-4.
Fixes https://sourceware.org/bugzilla/show_bug.cgi?id=31623.
ChangeLog | 5 +++++
libpoke/pkl-diag.c | 3 +++
2 files changed, 8 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index e4120fcf..014233ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-04-09 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
+
+ * libpoke/pkl-diag.c (pkl_detailed_location): Handle the failure
+ of `fseeko'.
+
2024-04-08 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
* libpoke/ios.c (realloc_string): Removed.
diff --git a/libpoke/pkl-diag.c b/libpoke/pkl-diag.c
index 2790388c..5675894f 100644
--- a/libpoke/pkl-diag.c
+++ b/libpoke/pkl-diag.c
@@ -72,6 +72,9 @@ pkl_detailed_location (pkl_ast ast, pkl_ast_loc loc,
/* Seek to the beginning of the file. */
tmp = fseeko (fp, 0, SEEK_SET);
+ if (tmp == -1)
+ /* File is not seekable. Do not add detailed info. */
+ return;
assert (tmp == 0);
while ((c = fgetc (fp)) != EOF)
--
2.44.0
- [COMMITTED] pkl-diag: skip detailed location generation for non-seekable inputs,
Mohammad-Reza Nabipoor <=