diff options
author | jilles <jilles@FreeBSD.org> | 2015-03-23 17:35:05 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2015-03-23 17:35:05 +0000 |
commit | 3845ab367c46f546d5690a7da4257886d5bbf6b5 (patch) | |
tree | c09f92320674225e164b0431dee8a057dfbceaf0 /bin | |
parent | 3f2fe981ddea196b0ce04f6a6b4251e239f724f9 (diff) | |
download | FreeBSD-src-3845ab367c46f546d5690a7da4257886d5bbf6b5.zip FreeBSD-src-3845ab367c46f546d5690a7da4257886d5bbf6b5.tar.gz |
cp,mv: Use futimens() instead of utimensat() if possible.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/cp/utils.c | 2 | ||||
-rw-r--r-- | bin/mv/mv.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/bin/cp/utils.c b/bin/cp/utils.c index e77a6c1..f58ed7a 100644 --- a/bin/cp/utils.c +++ b/bin/cp/utils.c @@ -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; diff --git a/bin/mv/mv.c b/bin/mv/mv.c index 999c8fc..a95b07a 100644 --- a/bin/mv/mv.c +++ b/bin/mv/mv.c @@ -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)) { |