Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Mar 2015 17:35:06 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r280386 - in head/bin: cp mv
Message-ID:  <201503231735.t2NHZ6E0099116@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Mon Mar 23 17:35:05 2015
New Revision: 280386
URL: https://svnweb.freebsd.org/changeset/base/280386

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

Modified:
  head/bin/cp/utils.c
  head/bin/mv/mv.c

Modified: head/bin/cp/utils.c
==============================================================================
--- head/bin/cp/utils.c	Mon Mar 23 17:31:22 2015	(r280385)
+++ head/bin/cp/utils.c	Mon Mar 23 17:35:05 2015	(r280386)
@@ -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;

Modified: head/bin/mv/mv.c
==============================================================================
--- head/bin/mv/mv.c	Mon Mar 23 17:31:22 2015	(r280385)
+++ head/bin/mv/mv.c	Mon Mar 23 17:35:05 2015	(r280386)
@@ -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)) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201503231735.t2NHZ6E0099116>