summaryrefslogtreecommitdiff
path: root/usr.bin/compress
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2015-05-03 19:45:00 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2015-05-03 19:45:00 +0000
commitbc2fc3a981e9f1e81a864da903f71bc8885ed881 (patch)
tree4d73f794dee15fdc020f1e173ad87d7a2e32c02a /usr.bin/compress
parent275944390ff923098350af0b244e2f4497a3fab0 (diff)
Preserve times to nanosecond precision instead of just microsecond.
Prefer to set attributes by fd for regular files, and not follwing symlinks for others. ok brynet@ millert@
Diffstat (limited to 'usr.bin/compress')
-rw-r--r--usr.bin/compress/main.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/compress/main.c b/usr.bin/compress/main.c
index c9e302598ff..4d91398b9a3 100644
--- a/usr.bin/compress/main.c
+++ b/usr.bin/compress/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.83 2015/01/16 06:40:06 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.84 2015/05/03 19:44:59 guenther Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -750,7 +750,7 @@ dodecompress(const char *in, char *out, const struct compressor *method,
void
setfile(const char *name, int fd, struct stat *fs)
{
- struct timeval tv[2];
+ struct timespec ts[2];
if (name == NULL || cat || testmode)
return;
@@ -784,10 +784,10 @@ setfile(const char *name, int fd, struct stat *fs)
if (fs->st_flags && fchflags(fd, fs->st_flags))
warn("fchflags: %s", name);
- TIMESPEC_TO_TIMEVAL(&tv[0], &fs->st_atimespec);
- TIMESPEC_TO_TIMEVAL(&tv[1], &fs->st_mtimespec);
- if (futimes(fd, tv))
- warn("futimes: %s", name);
+ ts[0] = fs->st_atim;
+ ts[1] = fs->st_mtim;
+ if (futimens(fd, ts))
+ warn("futimens: %s", name);
}
int