From 661aff600c5cb8e72aa2892a2a75ea6015bf1457 Mon Sep 17 00:00:00 2001 From: San Mehat Date: Wed, 3 Mar 2010 12:40:21 -0800 Subject: [PATCH] newfs_msdos: Allow -s option to work by itself Signed-off-by: San Mehat --- toolbox/newfs_msdos.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/toolbox/newfs_msdos.c b/toolbox/newfs_msdos.c index 8e611c60f..ff9e84465 100644 --- a/toolbox/newfs_msdos.c +++ b/toolbox/newfs_msdos.c @@ -414,11 +414,14 @@ newfs_msdos_main(int argc, char *argv[]) if (!(opt_f || (opt_h && opt_u && opt_S && opt_s && oflag))) { off_t delta; getdiskinfo(fd, fname, dtype, oflag, &bpb); + if (opt_s) { + bpb.bsec = opt_s; + } bpb.bsec -= (opt_ofs / bpb.bps); delta = bpb.bsec % bpb.spt; if (delta != 0) { - warnx("trim %d sectors to adjust to a multiple of %d", - (int)delta, bpb.spt); + warnx("trim %d sectors from %d to adjust to a multiple of %d", + (int)delta, bpb.bsec, bpb.spt); bpb.bsec -= delta; } if (bpb.spc == 0) { /* set defaults */