summaryrefslogtreecommitdiff
path: root/usr.bin/mail
diff options
context:
space:
mode:
authorJilles Tjoelker <jilles@FreeBSD.org>2016-04-17 20:00:24 +0000
committerJilles Tjoelker <jilles@FreeBSD.org>2016-04-17 20:00:24 +0000
commitae7d5745cdfdccf8c306f7dd67773fcc315a03aa (patch)
treea50ff6353d28fb7b7fba9f619c6b7e5ff9cad142 /usr.bin/mail
parent5a39901bc479651f37cebb788cc73f00582d13ec (diff)
downloadsrc-test-ae7d5745cdfdccf8c306f7dd67773fcc315a03aa.tar.gz
src-test-ae7d5745cdfdccf8c306f7dd67773fcc315a03aa.zip
mail: Don't truncate mtime of mailbox to microseconds.
Notes
Notes: svn path=/head/; revision=298157
Diffstat (limited to 'usr.bin/mail')
-rw-r--r--usr.bin/mail/util.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/usr.bin/mail/util.c b/usr.bin/mail/util.c
index b869fb0a3e832..43a0a554820e8 100644
--- a/usr.bin/mail/util.c
+++ b/usr.bin/mail/util.c
@@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$");
#include <sys/time.h>
+#include <fcntl.h>
+
#include "rcv.h"
#include "extern.h"
@@ -319,15 +321,13 @@ unstack(void)
void
alter(char *name)
{
- struct stat sb;
- struct timeval tv[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);
+ struct timespec ts[2];
+
+ (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);
}
/*