Compare commits

...

2 Commits

Author SHA1 Message Date
yova 5c43c7b0fb repair is successful
10 months ago
nift4 85ffd688e9 vold: fix failing to format zero-ed out SD card
11 months ago

@ -45,7 +45,7 @@ status_t Check(const std::string& source) {
cmd.push_back(source);
int rc = ForkExecvp(cmd, nullptr, sFsckUntrustedContext);
if (rc == 0) {
if (rc == 0 || rc == 1) {
LOG(INFO) << "Check OK";
return 0;
} else {

@ -471,26 +471,23 @@ status_t Disk::partitionPublic() {
std::vector<std::string> output;
res = ForkExecvp(cmd, &output);
if (res != OK) {
LOG(WARNING) << "sgdisk failed to scan " << mDevPath;
mJustPartitioned = false;
return res;
}
Table table = Table::kUnknown;
for (auto line : output) {
char* cline = (char*) line.c_str();
char* token = strtok(cline, kSgdiskToken);
if (token == nullptr) continue;
if (!strcmp(token, "DISK")) {
const char* type = strtok(nullptr, kSgdiskToken);
if (!strcmp(type, "mbr")) {
table = Table::kMbr;
break;
} else if (!strcmp(type, "gpt")) {
table = Table::kGpt;
break;
// fails when there is no partition table, it's okay
if (res == OK) {
for (auto line : output) {
char* cline = (char*) line.c_str();
char* token = strtok(cline, kSgdiskToken);
if (token == nullptr) continue;
if (!strcmp(token, "DISK")) {
const char* type = strtok(nullptr, kSgdiskToken);
if (!strcmp(type, "mbr")) {
table = Table::kMbr;
break;
} else if (!strcmp(type, "gpt")) {
table = Table::kGpt;
break;
}
}
}
}

Loading…
Cancel
Save