summaryrefslogtreecommitdiffstats
path: root/sys/fs/msdosfs
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2002-04-05 14:01:04 +0000
committerbde <bde@FreeBSD.org>2002-04-05 14:01:04 +0000
commit05507878209e2822f21815ede35a9936f34b0d03 (patch)
tree80d44507b99f2bd5a897a600137e0024160eb14b /sys/fs/msdosfs
parent0d2605253ba8117d7ff63e3ce2e1889003253d59 (diff)
downloadFreeBSD-src-05507878209e2822f21815ede35a9936f34b0d03.zip
FreeBSD-src-05507878209e2822f21815ede35a9936f34b0d03.tar.gz
Fixed a very old bug in setting timestamps using utimes(2) on msdosfs
files. We didn't clear the update marks when we set the times, so some of the settings were sometimes clobbered with the current time a little later. This caused cp -p even by root to almost always fail to preserve any times despite not reporting any errors in attempting to preserve them. Don't forget to set the archive attribute when we set the read-only attribute. We should only set the archive attribute if we actually change something, but we mostly don't bother avoiding setting it elsewhere, so don't bother here yet. MFC after: 1 week
Diffstat (limited to 'sys/fs/msdosfs')
-rw-r--r--sys/fs/msdosfs/msdosfs_vnops.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c
index f8e3742..e9a4160 100644
--- a/sys/fs/msdosfs/msdosfs_vnops.c
+++ b/sys/fs/msdosfs/msdosfs_vnops.c
@@ -455,10 +455,16 @@ msdosfs_setattr(ap)
return (error);
if (vp->v_type != VDIR) {
if ((pmp->pm_flags & MSDOSFSMNT_NOWIN95) == 0 &&
- vap->va_atime.tv_sec != VNOVAL)
- unix2dostime(&vap->va_atime, &dep->de_ADate, NULL, NULL);
- if (vap->va_mtime.tv_sec != VNOVAL)
- unix2dostime(&vap->va_mtime, &dep->de_MDate, &dep->de_MTime, NULL);
+ vap->va_atime.tv_sec != VNOVAL) {
+ dep->de_flag &= ~DE_ACCESS;
+ unix2dostime(&vap->va_atime, &dep->de_ADate,
+ NULL, NULL);
+ }
+ if (vap->va_mtime.tv_sec != VNOVAL) {
+ dep->de_flag &= ~DE_UPDATE;
+ unix2dostime(&vap->va_mtime, &dep->de_MDate,
+ &dep->de_MTime, NULL);
+ }
dep->de_Attributes |= ATTR_ARCHIVE;
dep->de_flag |= DE_MODIFIED;
}
@@ -480,6 +486,7 @@ msdosfs_setattr(ap)
dep->de_Attributes &= ~ATTR_READONLY;
else
dep->de_Attributes |= ATTR_READONLY;
+ dep->de_Attributes |= ATTR_ARCHIVE;
dep->de_flag |= DE_MODIFIED;
}
}
OpenPOWER on IntegriCloud