This is necessary to preserve the i_size of the output file; otherwise
programs like e2fsck will complain that the filesystem has been
truncated.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
int main(int argc, char **argv)
{
int fd, got, i;
+ int zflag = 0;
char buf[1024];
if (argc != 2) {
break;
if (i == sizeof(buf)) {
lseek(fd, sizeof(buf), SEEK_CUR);
+ zflag = 1;
continue;
}
}
+ zflag = 0;
write(fd, buf, got);
}
+ if (zflag) {
+ lseek(fd, -1, SEEK_CUR);
+ buf[0] = 0;
+ write(fd, buf, 1);
+ }
return 0;
}