summaryrefslogtreecommitdiffstats
path: root/mbox.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2020-07-07 21:09:03 -0700
committerKevin McCarthy <kevin@8t8.us>2020-07-08 12:48:54 -0700
commit222bd804148dc2bdb5e79df91d61fc3a28926f4f (patch)
tree3ceae3ae958ddbbb47539198335b234bb1ac99d1 /mbox.c
parent85ab28c96fcb1c2213f12076b655269a8b74ed61 (diff)
Fix utimensat() to use cwd for relative paths.
The utimensat() invocations were missing the AT_FDCWD parameter, meaning they would not work on relative paths. I can't remember whether I completely missed that difference from utime, or somehow thought all the paths would be full paths. :-( In any case, Mutt currently does not expand relative paths in mutt_expand_path(), so the paths can most certainly be relative in those calls too. This caused a bug where atimes were not being properly reset for mailbox entries.
Diffstat (limited to 'mbox.c')
-rw-r--r--mbox.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mbox.c b/mbox.c
index 9abb163d..10361184 100644
--- a/mbox.c
+++ b/mbox.c
@@ -115,7 +115,7 @@ int mmdf_parse_mailbox (CONTEXT *ctx)
ts[0].tv_nsec = UTIME_NOW;
ts[1].tv_sec = 0;
ts[1].tv_nsec = UTIME_OMIT;
- utimensat (0, ctx->path, ts, 0);
+ utimensat (AT_FDCWD, ctx->path, ts, 0);
#else
newtime.actime = time (NULL);
newtime.modtime = sb.st_mtime;
@@ -277,7 +277,7 @@ int mbox_parse_mailbox (CONTEXT *ctx)
ts[0].tv_nsec = UTIME_NOW;
ts[1].tv_sec = 0;
ts[1].tv_nsec = UTIME_OMIT;
- utimensat (0, ctx->path, ts, 0);
+ utimensat (AT_FDCWD, ctx->path, ts, 0);
#else
newtime.actime = time (NULL);
newtime.modtime = sb.st_mtime;