summaryrefslogtreecommitdiffstats
path: root/headers.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 /headers.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 'headers.c')
-rw-r--r--headers.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/headers.c b/headers.c
index e1af1d9e..a3d36fc1 100644
--- a/headers.c
+++ b/headers.c
@@ -77,6 +77,11 @@ int mutt_edit_headers (const char *editor,
}
sctx->tempfile_mtime = mutt_decrease_mtime (mutt_b2s (sctx->tempfile), &st);
+ if (sctx->tempfile_mtime == (time_t) -1)
+ {
+ mutt_perror (mutt_b2s (sctx->tempfile));
+ goto cleanup;
+ }
if (flags == MUTT_EDIT_HEADERS_BACKGROUND)
{