Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/dump Since the size passed in may be different from the...



details:   https://anonhg.NetBSD.org/src/rev/9e9e96a37c40
branches:  trunk
changeset: 545405:9e9e96a37c40
user:      fvdl <fvdl%NetBSD.org@localhost>
date:      Tue Apr 08 10:02:23 2003 +0000

description:
Since the size passed in may be different from the fs blocksize, just
allocate a buffer each time instead of using a static one.

diffstat:

 sbin/dump/traverse.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (42 lines):

diff -r e35f7e182eb4 -r 9e9e96a37c40 sbin/dump/traverse.c
--- a/sbin/dump/traverse.c      Tue Apr 08 09:44:47 2003 +0000
+++ b/sbin/dump/traverse.c      Tue Apr 08 10:02:23 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: traverse.c,v 1.38 2003/04/08 09:16:19 fvdl Exp $       */
+/*     $NetBSD: traverse.c,v 1.39 2003/04/08 10:02:23 fvdl Exp $       */
 
 /*-
  * Copyright (c) 1980, 1988, 1991, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)traverse.c 8.7 (Berkeley) 6/15/95";
 #else
-__RCSID("$NetBSD: traverse.c,v 1.38 2003/04/08 09:16:19 fvdl Exp $");
+__RCSID("$NetBSD: traverse.c,v 1.39 2003/04/08 10:02:23 fvdl Exp $");
 #endif
 #endif /* not lint */
 
@@ -407,11 +407,12 @@
        struct direct *dp;
        union dinode *ip;
        long loc, ret = 0;
-       static char *dblk;
+       char *dblk;
        ino_t ino;
 
-       if (dblk == NULL && (dblk = malloc(size)) == NULL)
-               quit("searchdir: cannot allocate indirect memory.\n");
+       dblk = malloc(size);
+       if (dblk == NULL)
+               quit("searchdir: cannot allocate directory memory.\n");
        bread(fsatoda(ufsib, blkno), dblk, (int)size);
        if (filesize < size)
                size = filesize;
@@ -459,6 +460,7 @@
                        }
                }
        }
+       free(dblk);
        return (ret);
 }
 



Home | Main Index | Thread Index | Old Index