diff options
author | Kevin McCarthy <kevin@8t8.us> | 2020-07-07 21:09:03 -0700 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2020-07-08 12:48:54 -0700 |
commit | 222bd804148dc2bdb5e79df91d61fc3a28926f4f (patch) | |
tree | 3ceae3ae958ddbbb47539198335b234bb1ac99d1 /buffy.c | |
parent | 85ab28c96fcb1c2213f12076b655269a8b74ed61 (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 'buffy.c')
-rw-r--r-- | buffy.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -42,6 +42,7 @@ #endif #include <string.h> +#include <fcntl.h> #include <sys/stat.h> #include <dirent.h> #include <utime.h> @@ -172,7 +173,7 @@ void mutt_buffy_cleanup (const char *buf, struct stat *st) ts[0].tv_nsec = UTIME_OMIT; ts[1].tv_sec = 0; ts[1].tv_nsec = UTIME_NOW; - utimensat (0, buf, ts, 0); + utimensat (AT_FDCWD, buf, ts, 0); #else ut.actime = st->st_atime; ut.modtime = time (NULL); @@ -186,7 +187,7 @@ void mutt_buffy_cleanup (const char *buf, struct stat *st) ts[0].tv_nsec = UTIME_NOW; ts[1].tv_sec = 0; ts[1].tv_nsec = UTIME_NOW; - utimensat (0, buf, ts, 0); + utimensat (AT_FDCWD, buf, ts, 0); #else utime (buf, NULL); #endif |