From ae7d5745cdfdccf8c306f7dd67773fcc315a03aa Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 17 Apr 2016 20:00:24 +0000 Subject: [PATCH] mail: Don't truncate mtime of mailbox to microseconds. --- usr.bin/mail/util.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/usr.bin/mail/util.c b/usr.bin/mail/util.c index b869fb0a3e83..43a0a554820e 100644 --- a/usr.bin/mail/util.c +++ b/usr.bin/mail/util.c @@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$"); #include +#include + #include "rcv.h" #include "extern.h" @@ -319,15 +321,13 @@ unstack(void) void alter(char *name) { - struct stat sb; - struct timeval tv[2]; + struct timespec ts[2]; - if (stat(name, &sb)) - return; - (void)gettimeofday(&tv[0], NULL); - tv[0].tv_sec++; - TIMESPEC_TO_TIMEVAL(&tv[1], &sb.st_mtim); - (void)utimes(name, tv); + (void)clock_gettime(CLOCK_REALTIME, &ts[0]); + ts[0].tv_sec++; + ts[1].tv_sec = 0; + ts[1].tv_nsec = UTIME_OMIT; + (void)utimensat(AT_FDCWD, name, ts, 0); } /*