X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=dump%2Ftraverse.c;h=632a6a39d4350823cd042318a36b17dd41ff3fab;hb=2fa54f1c7aa08d2c6e0b357a35c7e22d3ca302e0;hp=0ea5b96f7b355255844bc5f85672543ed2c25f15;hpb=a94ecd1155631b9f88488a19268874c0e3c6601c;p=dump.git diff --git a/dump/traverse.c b/dump/traverse.c index 0ea5b96..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.32 2001/04/10 13:42:22 stelian Exp $"; + "$Id: traverse.c,v 1.35 2001/07/18 08:50:58 stelian Exp $"; #endif /* not lint */ #include @@ -55,7 +55,11 @@ static const char rcsid[] = #include #include #ifdef __linux__ +#ifdef HAVE_EXT2FS_EXT2_FS_H +#include +#else #include +#endif #include #include #include @@ -796,9 +800,10 @@ void dumpino(struct dinode *dp, dump_ino_t ino) { unsigned long cnt; - fsizeT size; + fsizeT size, remaining; char buf[TP_BSIZE]; struct old_bsd_inode obi; + int i; #ifdef __linux__ struct block_context bc; #else @@ -915,6 +920,17 @@ dumpino(struct dinode *dp, dump_ino_t ino) bc.next_block = NDADDR; ext2fs_block_iterate2(fs, (ext2_ino_t)ino, 0, NULL, dumponeblock, (void *)&bc); + /* deal with holes at the end of the inode */ + 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) { + blksout (bc.buf, bc.cnt, bc.ino); + bc.cnt = 0; + } + } + } if (bc.cnt > 0) { blksout (bc.buf, bc.cnt, bc.ino); }