summaryrefslogtreecommitdiffstats
path: root/sys/msdosfs/msdosfs_denode.c
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1994-12-27 12:37:36 +0000
committerbde <bde@FreeBSD.org>1994-12-27 12:37:36 +0000
commit1587b568dd32b6f0f1d6cc5e282a606459d7ee2e (patch)
treeadf9bcdb7a70ae862914612112ca8fbaee09e226 /sys/msdosfs/msdosfs_denode.c
parent94497e0a34c7b774c88ebe2d120a83d82e6361f9 (diff)
downloadFreeBSD-src-1587b568dd32b6f0f1d6cc5e282a606459d7ee2e.zip
FreeBSD-src-1587b568dd32b6f0f1d6cc5e282a606459d7ee2e.tar.gz
Fix panic for `cp -p' by root to an msdos file system. Improve handling
of attributes so that `cp -p' to an msdos file system can succeed under favourable circumstances (no uid or gid changes and no nonzero flags except SF_ARCHIVED). msdosfs_vnops.c: The in-core inode flags were confused with the on-disk inode flags, so chflags() clobbered the lock flag and caused a panic. denode.h, msdosfs_denode.c, msdosfs_vnops.c: Support the msdosfs archive attibute (ATTR_ARCHIVE) by mapping it to the complement of the SF_ARCHIVED flag and setting the ATTR_ARCHIVE bit when a file's modification time is set (but not when a file's permissions are set; this is the standard wrong DOS behaviour). denode.h, msdosfs_denode.c: Remove the DE_UPDAT() macro. It was only used once, and the corresponding macro in ufs has already been removed. denode.h: Don't change the timestamp for directories in DE_TIMES() (be consistent with deupdat()). msdosfs_vnops.c: Handle chown() better: return EPERM instead of EINVAL if there are insufficient permissions; otherwise, allow null changes.
Diffstat (limited to 'sys/msdosfs/msdosfs_denode.c')
-rw-r--r--sys/msdosfs/msdosfs_denode.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/msdosfs/msdosfs_denode.c b/sys/msdosfs/msdosfs_denode.c
index b9720c0..c20b7e5 100644
--- a/sys/msdosfs/msdosfs_denode.c
+++ b/sys/msdosfs/msdosfs_denode.c
@@ -1,4 +1,4 @@
-/* $Id: msdosfs_denode.c,v 1.4 1994/10/10 07:57:32 phk Exp $ */
+/* $Id: msdosfs_denode.c,v 1.5 1994/12/12 12:35:43 bde Exp $ */
/* $NetBSD: msdosfs_denode.c,v 1.9 1994/08/21 18:44:00 ws Exp $ */
/*-
@@ -351,8 +351,10 @@ deupdat(dep, tp, waitfor)
* If the mtime is to be updated, put the passed in time into the
* directory entry.
*/
- if (dep->de_flag & DE_UPDATE)
+ if (dep->de_flag & DE_UPDATE) {
+ dep->de_Attributes |= ATTR_ARCHIVE;
unix2dostime(tp, &dep->de_Date, &dep->de_Time);
+ }
/*
* The mtime is now up to date. The denode will be unmodifed soon.
@@ -688,8 +690,10 @@ msdosfs_inactive(ap)
dep->de_flag |= DE_UPDATE;
dep->de_Name[0] = SLOT_DELETED;
}
- TIMEVAL_TO_TIMESPEC(&time, &ts);
- DE_UPDAT(dep, &ts, 0);
+ if (dep->de_flag & (DE_MODIFIED | DE_UPDATE)) {
+ TIMEVAL_TO_TIMESPEC(&time, &ts);
+ deupdat(dep, &ts, 0);
+ }
VOP_UNLOCK(vp);
dep->de_flag = 0;
OpenPOWER on IntegriCloud