From ad9220730d7bc96534093e6957268db49d05f7ad Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Wed, 18 Jul 2001 08:50:58 +0000 Subject: [PATCH] Fixed the looping problem in dump (deal with holes at the end of files). --- CHANGES | 5 ++++- dump/traverse.c | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 2ed2c17..94821f4 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.118 2001/06/18 11:07:45 stelian Exp $ +$Id: CHANGES,v 1.119 2001/07/18 08:50:58 stelian Exp $ Changes between versions 0.4b22 and 0.4b23 (released ????????????) ================================================================== @@ -18,6 +18,9 @@ Changes between versions 0.4b22 and 0.4b23 (released ????????????) positive passno or /etc/dumpdates in dump -w output. Patch submitted by Andreas Dilger . +5. Fixed the looping problem in dump introduced in the + previous version. + Changes between versions 0.4b21 and 0.4b22 (released May 12, 2001) ================================================================== diff --git a/dump/traverse.c b/dump/traverse.c index df59305..632a6a3 100644 --- a/dump/traverse.c +++ b/dump/traverse.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: traverse.c,v 1.34 2001/06/18 10:58:28 stelian Exp $"; + "$Id: traverse.c,v 1.35 2001/07/18 08:50:58 stelian Exp $"; #endif /* not lint */ #include @@ -921,8 +921,8 @@ dumpino(struct dinode *dp, dump_ino_t ino) ext2fs_block_iterate2(fs, (ext2_ino_t)ino, 0, NULL, dumponeblock, (void *)&bc); /* deal with holes at the end of the inode */ - remaining = i_size - bc.next_block*sblock->fs_fsize; - if (remaining > 0) + if (i_size > bc.next_block*sblock->fs_fsize) { + remaining = i_size - bc.next_block*sblock->fs_fsize; for (i = 0; i < howmany(remaining, sblock->fs_fsize); i++) { bc.buf[bc.cnt++] = 0; if (bc.cnt == bc.max) { @@ -930,6 +930,7 @@ dumpino(struct dinode *dp, dump_ino_t ino) bc.cnt = 0; } } + } if (bc.cnt > 0) { blksout (bc.buf, bc.cnt, bc.ino); } -- 2.39.2