summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-02-18 14:44:47 +0100
committerLukas Fleischer <calcurse@cryptocrack.de>2012-02-18 16:00:18 +0100
commitfb58416f459ecac570e2f2cb76672379eecf2da0 (patch)
tree05483ade1550177d568a18560720700bc34b551a /src
parent5130c4d02853f7435aba90caab37521d4dce4e45 (diff)
downloadcalcurse-fb58416f459ecac570e2f2cb76672379eecf2da0.tar.gz
calcurse-fb58416f459ecac570e2f2cb76672379eecf2da0.zip
Don't chomp on error in ical_readline_init()
Skip the newline check if fgets() returns a NULL string. Fixes another warning seen with "-Wunused-result". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src')
-rw-r--r--src/ical.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/ical.c b/src/ical.c
index 8d1735b..4360a76 100644
--- a/src/ical.c
+++ b/src/ical.c
@@ -425,10 +425,12 @@ ical_readline_init (FILE *fdi, char *buf, char *lstore, unsigned *ln)
char *eol;
*buf = *lstore = '\0';
- fgets (lstore, BUFSIZ, fdi);
- if ((eol = strchr(lstore, '\n')) != NULL)
- *eol = '\0';
- (*ln)++;
+ if (fgets (lstore, BUFSIZ, fdi))
+ {
+ if ((eol = strchr(lstore, '\n')) != NULL)
+ *eol = '\0';
+ (*ln)++;
+ }
}
static int