Commit b9aed74b authored by San Mehat's avatar San Mehat
Browse files

vold: Fix a few bugs


 - share command was taking wrong arguments
 - shared command was returning two termination codes
 - Force FAT32 cluster size to 4k when formatting
Signed-off-by: default avatarSan Mehat <san@google.com>
parent f5c61980
......@@ -61,9 +61,9 @@ int CommandListener::VolumeCmd::runCommand(SocketClient *cli,
} else if (!strcmp(argv[1], "format")) {
rc = vm->formatVolume(argv[2]);
} else if (!strcmp(argv[1], "share")) {
rc = vm->shareVolume(argv[1], argv[2]);
rc = vm->shareVolume(argv[2], argv[3]);
} else if (!strcmp(argv[1], "unshare")) {
rc = vm->unshareVolume(argv[1], argv[2]);
rc = vm->unshareVolume(argv[2], argv[3]);
} else if (!strcmp(argv[1], "shared")) {
bool enabled = false;
......@@ -74,6 +74,7 @@ int CommandListener::VolumeCmd::runCommand(SocketClient *cli,
cli->sendMsg(ResponseCode::ShareEnabledResult,
(enabled ? "Share enabled" : "Share disabled"), false);
}
return 0;
} else {
cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown volume cmd", false);
}
......@@ -93,6 +94,7 @@ int CommandListener::VolumeCmd::runCommand(SocketClient *cli,
} else if (errno == EBUSY) {
rc = ResponseCode::OpFailedVolBusy;
} else {
LOGW("Returning OperationFailed - no handler for errno %d", errno);
rc = ResponseCode::OperationFailed;
}
cli->sendMsg(rc, "volume operation failed", true);
......
......@@ -164,15 +164,17 @@ int Fat::format(const char *fsPath) {
}
close(fd);
const char *args[7];
const char *args[9];
int rc;
args[0] = MKDOSFS_PATH;
args[1] = "-F";
args[2] = "32";
args[3] = "-O";
args[4] = "android";
args[5] = fsPath;
args[6] = NULL;
args[5] = "-c";
args[6] = "8";
args[7] = fsPath;
args[8] = NULL;
rc = logwrap(7, args, 1);
if (rc == 0) {
......
......@@ -537,9 +537,9 @@ int VolumeManager::shareEnabled(const char *label, const char *method, bool *ena
}
if (v->getState() != Volume::State_Shared) {
*enabled = true;
} else {
*enabled = false;
} else {
*enabled = true;
}
return 0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment