Return -1 in io_file_is_empty() if file cannot be accessed.
Ensure files don't appear as empty if fopen() fails (e.g. on temporary EACCES failures). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
parent
371f20e631
commit
621b335179
@ -1048,7 +1048,7 @@ day_edit_note (char *editor)
|
|||||||
(void)snprintf (fullname, BUFSIZ, "%s%s", path_notes, p->note);
|
(void)snprintf (fullname, BUFSIZ, "%s%s", path_notes, p->note);
|
||||||
wins_launch_external (fullname, editor);
|
wins_launch_external (fullname, editor);
|
||||||
|
|
||||||
if (io_file_is_empty (fullname))
|
if (io_file_is_empty (fullname) > 0)
|
||||||
erase_note (&p->note, ERASE_FORCE);
|
erase_note (&p->note, ERASE_FORCE);
|
||||||
|
|
||||||
date = calendar_get_slctd_day_sec ();
|
date = calendar_get_slctd_day_sec ();
|
||||||
|
2
src/io.c
2
src/io.c
@ -3085,5 +3085,5 @@ io_file_is_empty (char *file)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -468,7 +468,7 @@ todo_edit_note (char *editor)
|
|||||||
(void)snprintf (fullname, BUFSIZ, "%s%s", path_notes, i->note);
|
(void)snprintf (fullname, BUFSIZ, "%s%s", path_notes, i->note);
|
||||||
wins_launch_external (fullname, editor);
|
wins_launch_external (fullname, editor);
|
||||||
|
|
||||||
if (io_file_is_empty (fullname))
|
if (io_file_is_empty (fullname) > 0)
|
||||||
erase_note (&i->note, ERASE_FORCE);
|
erase_note (&i->note, ERASE_FORCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user