diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2011-04-19 11:24:33 +0200 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2011-04-22 02:47:38 +0200 |
commit | 621b3351798f5c78c5907bcfbc10217a63c4ae3f (patch) | |
tree | f480c9f3afb40b3b0a7ec2ad95dbd92302605f95 | |
parent | 371f20e6315715c9af3df3ef7dbbe8db46dd6347 (diff) | |
download | calcurse-621b3351798f5c78c5907bcfbc10217a63c4ae3f.zip |
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>
-rw-r--r-- | src/day.c | 2 | ||||
-rw-r--r-- | src/io.c | 2 | ||||
-rw-r--r-- | src/todo.c | 2 |
3 files changed, 3 insertions, 3 deletions
@@ -1048,7 +1048,7 @@ day_edit_note (char *editor) (void)snprintf (fullname, BUFSIZ, "%s%s", path_notes, p->note); wins_launch_external (fullname, editor); - if (io_file_is_empty (fullname)) + if (io_file_is_empty (fullname) > 0) erase_note (&p->note, ERASE_FORCE); date = calendar_get_slctd_day_sec (); @@ -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); wins_launch_external (fullname, editor); - if (io_file_is_empty (fullname)) + if (io_file_is_empty (fullname) > 0) erase_note (&i->note, ERASE_FORCE); } |