summaryrefslogtreecommitdiffstats
path: root/usr.sbin/mtree/compare.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-10-31 13:39:19 +0000
committerphk <phk@FreeBSD.org>2003-10-31 13:39:19 +0000
commit4ad1bf034220b7e1df9292a18160247ca8f5b2be (patch)
tree4913a6045b220629ada65dbb52134d9039d6bc9a /usr.sbin/mtree/compare.c
parenta325916ce64cb9bb29e5651fb77e344176fbe28c (diff)
downloadFreeBSD-src-4ad1bf034220b7e1df9292a18160247ca8f5b2be.zip
FreeBSD-src-4ad1bf034220b7e1df9292a18160247ca8f5b2be.tar.gz
Make mtree's update function update the modification time too.
Submitted by: Dan Nelson <dnelson@allantgroup.com> PR: 53063
Diffstat (limited to 'usr.sbin/mtree/compare.c')
-rw-r--r--usr.sbin/mtree/compare.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.sbin/mtree/compare.c b/usr.sbin/mtree/compare.c
index 8fad8a4..fbe9775 100644
--- a/usr.sbin/mtree/compare.c
+++ b/usr.sbin/mtree/compare.c
@@ -184,8 +184,21 @@ typeerr: LABEL;
LABEL;
(void)printf("%smodification time expected %.24s ",
tab, ctime(&s->st_mtimespec.tv_sec));
- (void)printf("found %.24s\n",
+ (void)printf("found %.24s",
ctime(&p->fts_statp->st_mtimespec.tv_sec));
+ if (uflag) {
+ struct timeval tv[2];
+ tv[0].tv_sec = s->st_mtimespec.tv_sec;
+ tv[0].tv_usec = s->st_mtimespec.tv_nsec / 1000;
+ tv[1] = tv[0];
+ if (utimes(p->fts_accpath, tv))
+ (void)printf(" not modified: %s\n",
+ strerror(errno));
+ else
+ (void)printf(" modified\n");
+ } else
+ (void)printf("\n");
+
tab = "\t";
}
if (s->flags & F_CKSUM) {
OpenPOWER on IntegriCloud