changeset 10939:343d43cca32b

6897583 touch(1) calls both futimens(2) and utimensat(2) on newly created files
author Marcel Telka <Marcel.Telka@Sun.COM>
date Tue, 03 Nov 2009 22:45:46 +0100
parents 270624bd70f1
children c04a3259b948
files usr/src/cmd/touch/touch.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/touch/touch.c	Tue Nov 03 11:02:16 2009 -0700
+++ b/usr/src/cmd/touch/touch.c	Tue Nov 03 22:45:46 2009 +0100
@@ -239,7 +239,7 @@
 		}
 
 		if ((fd >= 0 && futimens(fd, tsp) != 0) ||
-		    utimensat(AT_FDCWD, argv[c], tsp, 0) != 0) {
+		    (fd < 0 && utimensat(AT_FDCWD, argv[c], tsp, 0) != 0)) {
 			(void) fprintf(stderr,
 			    gettext("%s: cannot change times on %s: %s\n"),
 			    myname, argv[c], strerror(errno));