summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Rosenberg <drosen@google.com>2014-10-10 14:40:48 -0700
committerDaniel Rosenberg <drosen@google.com>2014-10-10 14:40:48 -0700
commit8218b6aae9cd4a19fa074a8a8203fe9275b35447 (patch)
tree978bc7c6b32bc63a14ec9fb18865dde471625d39
parent3fe9adc932948da8993d3f812bce1875efc47c0e (diff)
downloadcore-8218b6aae9cd4a19fa074a8a8203fe9275b35447.tar.gz
newfs_msdos: Set sectors per fat once
There was an issue causing the fat size to shrink too small, causing a fsck check to fail. Bug: 17949028 Bug: 17761281 Change-Id: Id0207f2ab44e57ff81f5a53494b45344822a6495 Signed-off-by: Daniel Rosenberg <drosen@google.com>
-rw-r--r--toolbox/newfs_msdos.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/toolbox/newfs_msdos.c b/toolbox/newfs_msdos.c
index f69987cfd..01517fd2d 100644
--- a/toolbox/newfs_msdos.c
+++ b/toolbox/newfs_msdos.c
@@ -590,7 +590,9 @@ int newfs_msdos_main(int argc, char *argv[])
(bpb.spc * bpb.bps * NPB + fat / BPN * bpb.nft);
x2 = howmany((RESFTE + MIN(x, maxcls(fat))) * (fat / BPN), bpb.bps * NPB);
if (set_spf) {
- bpb.bspf = x2;
+ if (!bpb.bspf) {
+ bpb.bspf = x2;
+ }
x1 += (bpb.bspf - 1) * bpb.nft;
}
if(set_res) {