cp,mv: Use futimens() instead of utimensat() if possible.

This commit is contained in:
Jilles Tjoelker 2015-03-23 17:35:05 +00:00
parent f0c61ded93
commit 347b9f6de0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=280386
2 changed files with 2 additions and 2 deletions

View File

@ -342,7 +342,7 @@ setfile(struct stat *fs, int fd)
tspec[0] = fs->st_atim;
tspec[1] = fs->st_mtim;
if (utimensat(AT_FDCWD, to.p_path, tspec,
if (fdval ? futimens(fd, tspec) : utimensat(AT_FDCWD, to.p_path, tspec,
islink ? AT_SYMLINK_NOFOLLOW : 0)) {
warn("utimensat: %s", to.p_path);
rval = 1;

View File

@ -352,7 +352,7 @@ err: if (unlink(to))
ts[0] = sbp->st_atim;
ts[1] = sbp->st_mtim;
if (utimensat(AT_FDCWD, to, ts, 0))
if (futimens(to_fd, ts))
warn("%s: set times", to);
if (close(to_fd)) {