summaryrefslogtreecommitdiffstats
path: root/sbin/restore/dirs.c
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2002-07-17 02:03:19 +0000
committermckusick <mckusick@FreeBSD.org>2002-07-17 02:03:19 +0000
commit3abb526f86a27b005f352fb91f605228876fa8f7 (patch)
tree5b5d1d91499a541486f56f84b49c10edeafd66b2 /sbin/restore/dirs.c
parent9498a983a938cec96851b64642f0b62bba7d1827 (diff)
downloadFreeBSD-src-3abb526f86a27b005f352fb91f605228876fa8f7.zip
FreeBSD-src-3abb526f86a27b005f352fb91f605228876fa8f7.tar.gz
Change utimes to set the file creation time (for filesystems that
support creation times such as UFS2) to the value of the modification time if the value of the modification time is older than the current creation time. See utimes(2) for further details. Sponsored by: DARPA & NAI Labs.
Diffstat (limited to 'sbin/restore/dirs.c')
-rw-r--r--sbin/restore/dirs.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/sbin/restore/dirs.c b/sbin/restore/dirs.c
index 323e9ff..dba5738 100644
--- a/sbin/restore/dirs.c
+++ b/sbin/restore/dirs.c
@@ -82,7 +82,8 @@ static struct inotab *inotab[HASHSIZE];
*/
struct modeinfo {
ino_t ino;
- struct timeval timep[2];
+ struct timeval ctimep[2];
+ struct timeval mtimep[2];
mode_t mode;
uid_t uid;
gid_t gid;
@@ -597,7 +598,8 @@ setdirmodes(int flags)
if (!Nflag) {
(void) chown(cp, node.uid, node.gid);
(void) chmod(cp, node.mode);
- utimes(cp, node.timep);
+ utimes(cp, node.ctimep);
+ utimes(cp, node.mtimep);
(void) chflags(cp, node.flags);
}
ep->e_flags &= ~NEW;
@@ -685,10 +687,14 @@ allocinotab(struct context *ctxp, long seekpt)
if (mf == NULL)
return (itp);
node.ino = ctxp->ino;
- node.timep[0].tv_sec = ctxp->atime_sec;
- node.timep[0].tv_usec = ctxp->atime_nsec / 1000;
- node.timep[1].tv_sec = ctxp->mtime_sec;
- node.timep[1].tv_usec = ctxp->mtime_nsec / 1000;
+ node.mtimep[0].tv_sec = ctxp->atime_sec;
+ node.mtimep[0].tv_usec = ctxp->atime_nsec / 1000;
+ node.mtimep[1].tv_sec = ctxp->mtime_sec;
+ node.mtimep[1].tv_usec = ctxp->mtime_nsec / 1000;
+ node.ctimep[0].tv_sec = ctxp->atime_sec;
+ node.ctimep[0].tv_usec = ctxp->atime_nsec / 1000;
+ node.ctimep[1].tv_sec = ctxp->birthtime_sec;
+ node.ctimep[1].tv_usec = ctxp->birthtime_nsec / 1000;
node.mode = ctxp->mode;
node.flags = ctxp->file_flags;
node.uid = ctxp->uid;
OpenPOWER on IntegriCloud