From 27c5f7cba322a400fd4971eece5593f31994077d Mon Sep 17 00:00:00 2001 From: pooka Date: Sun, 22 Jul 2007 13:19:38 +0000 Subject: [PATCH] Match code with comment (can't really remember doing it often that way around .. ) and initialize storage to zero when extending a file. --- share/examples/puffs/dtfs/dtfs_subr.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/share/examples/puffs/dtfs/dtfs_subr.c b/share/examples/puffs/dtfs/dtfs_subr.c index 73ced3cfda60..48d3e5d8b6a1 100644 --- a/share/examples/puffs/dtfs/dtfs_subr.c +++ b/share/examples/puffs/dtfs/dtfs_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: dtfs_subr.c,v 1.19 2007/07/17 16:33:27 pooka Exp $ */ +/* $NetBSD: dtfs_subr.c,v 1.20 2007/07/22 13:19:38 pooka Exp $ */ /* * Copyright (c) 2006 Antti Kantee. All Rights Reserved. @@ -257,9 +257,12 @@ dtfs_setsize(struct puffs_node *pn, off_t newsize) * if extended, set storage to zero * to match correct behaviour */ - if (!shrinks) - for (i = df->df_numblocks; i < newblocks; i++) + if (!shrinks) { + for (i = df->df_numblocks; i < newblocks; i++) { df->df_blocks[i] = emalloc(DTFS_BLOCKSIZE); + memset(df->df_blocks[i], 0, DTFS_BLOCKSIZE); + } + } df->df_datalen = newsize; df->df_numblocks = newblocks;