summaryrefslogtreecommitdiff
path: root/util-linux/mkfs_ext2.c
diff options
context:
space:
mode:
authorDenys Vlasenko2009-10-22 12:27:10 +0200
committerDenys Vlasenko2009-10-22 12:27:10 +0200
commit09bbb2892da80efac4451e46683f9361d59cefd5 (patch)
tree49868535e07d97521292744f3511bd2936bdebd5 /util-linux/mkfs_ext2.c
parentc1ab01b61b5e37bbf8f412f6b0c451f1e6382c74 (diff)
downloadbusybox-09bbb2892da80efac4451e46683f9361d59cefd5.zip
busybox-09bbb2892da80efac4451e46683f9361d59cefd5.tar.gz
mkfs_ext2: fix a bug where we don't fully respect -n on files
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/mkfs_ext2.c')
-rw-r--r--util-linux/mkfs_ext2.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/util-linux/mkfs_ext2.c b/util-linux/mkfs_ext2.c
index 10f7f5f..ea35e52 100644
--- a/util-linux/mkfs_ext2.c
+++ b/util-linux/mkfs_ext2.c
@@ -233,7 +233,8 @@ int mkfs_ext2_main(int argc UNUSED_PARAM, char **argv)
kilobytes = xatoull(argv[1]);
// seek past end fails on block devices but works on files
if (lseek(fd, kilobytes * 1024 - 1, SEEK_SET) != (off_t)-1) {
- xwrite(fd, "", 1); // file grows if needed
+ if (!(opts & OPT_n))
+ xwrite(fd, "", 1); // file grows if needed
}
//else {
// bb_error_msg("warning, block device is smaller");