Use correct minor device number to format SD card

When formatting SD card partitions, instead of assuming partition
minor device numbers start from 1, use (minor device number of
the disk device + 1) as the starting point.

Bug: 11352632
Change-Id: I69d37f57aec6b62fe2a055470f7525ec09dc3859
Signed-off-by: Blair Prescott <blairp@broadcom.com>
Signed-off-by: Pierre <pierre@broadcom.com>
gugelfrei
Blair Prescott 11 years ago committed by Jeff Sharkey
parent bcdbd9ac06
commit cc21d6ea58

@ -250,7 +250,9 @@ int Volume::formatVol(bool wipe) {
bool formatEntireDevice = (mPartIdx == -1);
char devicePath[255];
dev_t diskNode = getDiskDevice();
dev_t partNode = MKDEV(MAJOR(diskNode), (formatEntireDevice ? 1 : mPartIdx));
dev_t partNode =
MKDEV(MAJOR(diskNode),
MINOR(diskNode) + (formatEntireDevice ? 1 : mPartIdx));
setState(Volume::State_Formatting);

Loading…
Cancel
Save