summaryrefslogtreecommitdiffstats
path: root/usr.sbin/vipw
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2007-11-17 16:09:29 +0000
committermillert <millert@openbsd.org>2007-11-17 16:09:29 +0000
commitbe27b01e326b51443435688f647ba5d73fe297d0 (patch)
tree7d9fe3bc3a4b81cada203d035a7830063aa2bcb1 /usr.sbin/vipw
parentcvs header (diff)
downloadwireguard-openbsd-be27b01e326b51443435688f647ba5d73fe297d0.tar.xz
wireguard-openbsd-be27b01e326b51443435688f647ba5d73fe297d0.zip
Deal with timespec vs. timeval precision issues. Fixes a problem
where the "no changes" case was not properly detected due to timespec supporting nanosec resolution but timeval only supporting microsec resolution. OK deraadt@
Diffstat (limited to 'usr.sbin/vipw')
-rw-r--r--usr.sbin/vipw/vipw.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.sbin/vipw/vipw.c b/usr.sbin/vipw/vipw.c
index 3b8debb7e57..012800221e6 100644
--- a/usr.sbin/vipw/vipw.c
+++ b/usr.sbin/vipw/vipw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vipw.c,v 1.13 2003/06/02 23:36:55 millert Exp $ */
+/* $OpenBSD: vipw.c,v 1.14 2007/11/17 16:09:29 millert Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@@ -119,6 +119,9 @@ copyfile(int from, int to, struct stat *sb)
TIMESPEC_TO_TIMEVAL(&tv[0], &sb->st_atimespec);
TIMESPEC_TO_TIMEVAL(&tv[1], &sb->st_mtimespec);
(void)futimes(to, tv);
+
+ /* Make tv_nsec the same precision as tv_usec so it compares OK. */
+ TIMEVAL_TO_TIMESPEC(&tv[1], &sb->st_mtimespec);
}
void