]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE14-up-preserve-dir-mtime-20070507
authorRuss Allbery <rra@stanford.edu>
Mon, 7 May 2007 18:23:11 +0000 (18:23 +0000)
committerRuss Allbery <rra@stanford.edu>
Mon, 7 May 2007 18:23:11 +0000 (18:23 +0000)
FIXES 34522

Set the mtime on newly created directories to match the original directory.

(cherry picked from commit 1d4d8f5c4f125707fc6af432024d99e2672cadab)

src/venus/up.c

index 7544343503b6fdb54d82208344bae62f3b91aecb..b8305ea9cc8ec7f743365936bfc5ca700404a92a 100644 (file)
@@ -528,6 +528,7 @@ Copy(file1, file2, recursive, level)
        char f1[MAXPATHLEN], f2[MAXPATHLEN];
        char *p1, *p2;
        struct dirent *d;
+       struct timeval tv[2];
 
        if (verbose) {
            printf("Level %d: Directory %s to %s\n", level, file1, file2);
@@ -689,6 +690,15 @@ Copy(file1, file2, recursive, level)
                printf("Not setting acls\n");
            }
        }
+
+        /* preserve access and modification times: ("-x" disables) */
+        if (preserveDate) {
+            tv[0].tv_sec = s1.st_atime;
+            tv[0].tv_usec = 0;
+            tv[1].tv_sec = s1.st_mtime;
+            tv[1].tv_usec = 0;
+            utimes(file2, tv);
+        }
     }
 
     return rcode;