diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-02-18 14:44:47 +0100 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-02-18 16:00:18 +0100 |
commit | fb58416f459ecac570e2f2cb76672379eecf2da0 (patch) | |
tree | 05483ade1550177d568a18560720700bc34b551a /src | |
parent | 5130c4d02853f7435aba90caab37521d4dce4e45 (diff) | |
download | 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.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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 |