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:
parent
5130c4d028
commit
fb58416f45
10
src/ical.c
10
src/ical.c
@ -425,10 +425,12 @@ ical_readline_init (FILE *fdi, char *buf, char *lstore, unsigned *ln)
|
|||||||
char *eol;
|
char *eol;
|
||||||
|
|
||||||
*buf = *lstore = '\0';
|
*buf = *lstore = '\0';
|
||||||
fgets (lstore, BUFSIZ, fdi);
|
if (fgets (lstore, BUFSIZ, fdi))
|
||||||
if ((eol = strchr(lstore, '\n')) != NULL)
|
{
|
||||||
*eol = '\0';
|
if ((eol = strchr(lstore, '\n')) != NULL)
|
||||||
(*ln)++;
|
*eol = '\0';
|
||||||
|
(*ln)++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user