From 8c2e6bdc0cb26fc740663daf972db793c1d4f28c Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Fri, 18 Aug 2006 16:05:00 +0000 Subject: [PATCH] Properly update the mtime for directories. Requested-by: Oliver Fromme --- bin/cpdup/cpdup.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bin/cpdup/cpdup.c b/bin/cpdup/cpdup.c index 56a505ba87..b10995421c 100644 --- a/bin/cpdup/cpdup.c +++ b/bin/cpdup/cpdup.c @@ -45,7 +45,7 @@ * - Is able to do incremental mirroring/backups via hardlinks from * the 'previous' version (supplied with -H path). * - * $DragonFly: src/bin/cpdup/cpdup.c,v 1.15 2006/08/18 01:13:51 dillon Exp $ + * $DragonFly: src/bin/cpdup/cpdup.c,v 1.16 2006/08/18 16:05:00 dillon Exp $ */ /*- @@ -784,6 +784,8 @@ relink: } if (dpath) { + struct timeval tv[2]; + if (ForceOpt || st2Valid == 0 || st1.st_uid != st2.st_uid || @@ -799,6 +801,15 @@ relink: hc_chflags(&DstHost, dpath, st1.st_flags); } #endif + if (ForceOpt || + st2Valid == 0 || + st1.st_mtime != st2.st_mtime + ) { + bzero(tv, sizeof(tv)); + tv[0].tv_sec = st1.st_mtime; + tv[1].tv_sec = st1.st_mtime; + hc_utimes(&DstHost, dpath, tv); + } } } } else if (dpath == NULL) { -- 2.41.0