summaryrefslogtreecommitdiffstats
path: root/editmsg.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2020-05-08 13:47:41 -0700
committerKevin McCarthy <kevin@8t8.us>2020-05-08 14:11:45 -0700
commit1aa61c2e6e03625813d3e6283e166f82c7bc4b9c (patch)
tree3e02f1fdcc419d4fedd059e61f980bf3cf6b9f60 /editmsg.c
parent0829476975d24a795b7164ad8a3d9e9f0331452f (diff)
Improve mutt_decrease_mtime() error handling.
Add a check for utime failure. Some non-posix implementations return EINTR. Since editing messages is a very common operation in Mutt, take care to retry in that case so as not to introduce message composition failures. Make sure all callers check mutt_decrease_mtime()'s return value, since stat could also fail.
Diffstat (limited to 'editmsg.c')
-rw-r--r--editmsg.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/editmsg.c b/editmsg.c
index 82437cb2..384f5d6b 100644
--- a/editmsg.c
+++ b/editmsg.c
@@ -123,7 +123,12 @@ static int edit_one_message (CONTEXT *ctx, HEADER *cur)
goto bail;
}
- mtime = mutt_decrease_mtime (mutt_b2s (tmp), &sb);
+ if ((mtime = mutt_decrease_mtime (mutt_b2s (tmp), &sb)) == (time_t) -1)
+ {
+ rc = -1;
+ mutt_perror (mutt_b2s (tmp));
+ goto bail;
+ }
mutt_edit_file (NONULL(Editor), mutt_b2s (tmp));