summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/ufs/ffs/ffs_inode.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c
index 21978dbb82b..225ccc23acb 100644
--- a/sys/ufs/ffs/ffs_inode.c
+++ b/sys/ufs/ffs/ffs_inode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_inode.c,v 1.14 1999/12/06 07:03:04 art Exp $ */
+/* $OpenBSD: ffs_inode.c,v 1.15 1999/12/06 07:23:21 art Exp $ */
/* $NetBSD: ffs_inode.c,v 1.10 1996/05/11 18:27:19 mycroft Exp $ */
/*
@@ -275,10 +275,11 @@ ffs_truncate(v)
/*
* Shorten the size of the file. If the file is not being
- * truncated to a block boundry, the contents of the
+ * truncated to a block boundary, the contents of the
* partial block following the end of the file must be
- * zero'ed in case it ever become accessable again because
- * of subsequent file growth.
+ * zero'ed in case it ever become accessible again because
+ * of subsequent file growth. Directories however are not
+ * zero'ed as they should grow back initialized to empty.
*/
offset = blkoff(fs, length);
if (offset == 0) {
@@ -299,7 +300,9 @@ ffs_truncate(v)
#else
(void) vnode_pager_uncache(ovp);
#endif
- bzero((char *)bp->b_data + offset, (u_int)(size - offset));
+ if (ovp->v_type != VDIR)
+ bzero((char *)bp->b_data + offset,
+ (u_int)(size - offset));
allocbuf(bp, size);
if (aflags & B_SYNC)
bwrite(bp);