[git commit master] mkfs_ext2: fix a bug where we don't fully respect -n on files

Denys Vlasenko vda.linux at googlemail.com
Thu Oct 22 10:27:10 UTC 2009


commit: http://git.busybox.net/busybox/commit/?id=09bbb2892da80efac4451e46683f9361d59cefd5
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 util-linux/mkfs_ext2.c |    3 ++-
 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");
-- 
1.6.3.3



More information about the busybox-cvs mailing list