item_row_get: exit early if there is a read error - sfeed_curses - sfeed curses UI (now part of sfeed, development is in sfeed)
(HTM) git clone git://git.codemadness.org/sfeed_curses
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit b4c423045934c3a9562091b8cf2d5db888d3a136
(DIR) parent 59bea5033b7176b6ae9554670bdd02cb76009fae
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 14 Jul 2021 17:57:38 +0200
item_row_get: exit early if there is a read error
Only affected if SFEED_LAZYLOAD=1 and there is a read error reading the line.
This used to silently ignore the error and show a blank line.
Diffstat:
M sfeed_curses.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/sfeed_curses.c b/sfeed_curses.c
@@ -1882,10 +1882,12 @@ item_row_get(struct pane *p, off_t pos)
if (f && f->path && f->fp && !item->line) {
if (fseek(f->fp, item->offset, SEEK_SET))
die("fseek: %s", f->path);
- linelen = getline(&line, &linesize, f->fp);
- if (linelen <= 0)
+ if ((linelen = getline(&line, &linesize, f->fp)) <= 0) {
+ if (ferror(f->fp))
+ die("getline: %s", f->path);
return NULL;
+ }
if (line[linelen - 1] == '\n')
line[--linelen] = '\0';