aboutsummaryrefslogtreecommitdiffstats
path: root/src/ical.c
diff options
context:
space:
mode:
authorLars Henriksen <LarsHenriksen@get2net.dk>2020-11-15 09:21:47 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2020-11-15 12:11:27 -0500
commite3dd92ef71ecd06ef2a3ef2ef49beccb5d22cc0f (patch)
treec3b670ef7c5c8a79167926965d138acdf0c1bc48 /src/ical.c
parente1b5580bdf323959b08054cceec01174b9d33ded (diff)
downloadcalcurse-e3dd92ef71ecd06ef2a3ef2ef49beccb5d22cc0f.tar.gz
calcurse-e3dd92ef71ecd06ef2a3ef2ef49beccb5d22cc0f.zip
Do not remove an empty note file after edit session
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/ical.c')
-rw-r--r--src/ical.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ical.c b/src/ical.c
index 2ce378c..160afc2 100644
--- a/src/ical.c
+++ b/src/ical.c
@@ -213,8 +213,10 @@ static void ical_export_note(FILE *stream, char *name)
int has_desc, has_prop, i;
asprintf(&note_file, "%s/%s", path_notes, name);
- if (!(fp = fopen(note_file, "r")))
+ if (!(fp = fopen(note_file, "r")) || ungetc(getc(fp), fp) == EOF) {
+ fclose(fp);
return;
+ }
string_init(&note);
while (fgets(lbuf, BUFSIZ, fp))
string_catf(&note, "%s", lbuf);