vold: fix 64 bit ioctl error
Changing the num_sectors used in ioctl with BLKGETSIZE because
the kernel expects an unsigned long type and then changes 64 bits
with a 64 bits userspace. This overwrites what's located close to
the parameter location if any.
Change-Id: I78fd61a1084de2741f39b926aa436462518709a0
Signed-off-by: Mateusz Nowak <mateusz.nowak@intel.com>
Signed-off-by: Zhiquan Liu <zhiquan.liu@intel.com>
diff --git a/fs/Vfat.cpp b/fs/Vfat.cpp
index 7bd05ec..7338c1e 100644
--- a/fs/Vfat.cpp
+++ b/fs/Vfat.cpp
@@ -164,7 +164,7 @@
return rc;
}
-status_t Format(const std::string& source, unsigned int numSectors) {
+status_t Format(const std::string& source, unsigned long numSectors) {
std::vector<std::string> cmd;
cmd.push_back(kMkfsPath);
cmd.push_back("-F");
@@ -177,7 +177,7 @@
if (numSectors) {
cmd.push_back("-s");
- cmd.push_back(StringPrintf("%u", numSectors));
+ cmd.push_back(StringPrintf("%lu", numSectors));
}
cmd.push_back(source);