mkfs_ext2: fix a bug where we don't fully respect -n on files
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
c1ab01b61b
commit
09bbb2892d
@ -233,6 +233,7 @@ int mkfs_ext2_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
kilobytes = xatoull(argv[1]);
|
kilobytes = xatoull(argv[1]);
|
||||||
// seek past end fails on block devices but works on files
|
// seek past end fails on block devices but works on files
|
||||||
if (lseek(fd, kilobytes * 1024 - 1, SEEK_SET) != (off_t)-1) {
|
if (lseek(fd, kilobytes * 1024 - 1, SEEK_SET) != (off_t)-1) {
|
||||||
|
if (!(opts & OPT_n))
|
||||||
xwrite(fd, "", 1); // file grows if needed
|
xwrite(fd, "", 1); // file grows if needed
|
||||||
}
|
}
|
||||||
//else {
|
//else {
|
||||||
|
Loading…
Reference in New Issue
Block a user