From fb58416f459ecac570e2f2cb76672379eecf2da0 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Sat, 18 Feb 2012 14:44:47 +0100 Subject: 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 --- src/ical.c | 10 ++++++---- 1 file 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 -- cgit v1.2.3-70-g09d2