write empty indirect blocks when dumping to stdout
This commit is contained in:
parent
36a07e26e7
commit
1325027567
12
dump_inode.c
12
dump_inode.c
|
@ -304,6 +304,12 @@ void dump_file_indirect(union dinode *dp, void *indirblock, int level,
|
|||
gapsize *= NINDIR(sblock);
|
||||
}
|
||||
*filesize -= gapsize;
|
||||
if (filefd == STDOUT_FILENO) {
|
||||
memset(datablock, 0, sblock->fs_bsize);
|
||||
for (int j = 0; j < gapsize / sblock->fs_bsize; j++) {
|
||||
xwrite(filefd, datablock, sblock->fs_bsize);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
daddr_t blkno = fsbtodb(sblock, fsblkno);
|
||||
|
@ -350,6 +356,12 @@ void dump_file(union dinode *dp) {
|
|||
gapsize *= NINDIR(sblock);
|
||||
}
|
||||
filesize -= gapsize;
|
||||
if (filefd == STDOUT_FILENO) {
|
||||
memset(datablock, 0, sblock->fs_bsize);
|
||||
for (int j = 0; j < gapsize / sblock->fs_bsize; j++) {
|
||||
xwrite(filefd, datablock, sblock->fs_bsize);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
daddr_t blkno = fsbtodb(sblock, DIP(dp, di_ib[i]));
|
||||
|
|
Loading…
Reference in a new issue