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>
This commit is contained in:
Lukas Fleischer 2012-02-18 14:44:47 +01:00
parent 5130c4d028
commit fb58416f45

View File

@ -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