If the size of the last "hole" in the raw file was an exact multiple
of a megabyte, then we wouldn't write a null at the end of the file in
order to extend the size of the raw image to correspond with the file
system size. Thanks to Lukas Czerner for suggesting the fix, and
Phillip Susi for pointing out the problem.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
continue;
}
sparse += fs->blocksize;
- if (sparse >= 1024*1024) {
-
- write_block(fd, 0, sparse, 0, 0);
- sparse = 0;
+ if (sparse > 1024*1024) {
+ write_block(fd, 0, 1024*1024, 0, 0);
+ sparse -= 1024*1024;
}
}
}