Handle missing UUID/LABEL from blkid.
Bug: 11627785 Change-Id: Iee757abbc3795234f41d513a6aed8ad33855cb7a
This commit is contained in:
parent
cc21d6ea58
commit
6bcd362edd
1 changed files with 4 additions and 4 deletions
|
@ -668,15 +668,15 @@ int Volume::extractMetadata(const char* devicePath) {
|
|||
if (fgets(line, sizeof(line), fp) != NULL) {
|
||||
ALOGD("blkid identified as %s", line);
|
||||
|
||||
char* start = strstr(line, "UUID=") + 5;
|
||||
if (sscanf(start, "\"%127[^\"]\"", value) == 1) {
|
||||
char* start = strstr(line, "UUID=");
|
||||
if (start != NULL && sscanf(start + 5, "\"%127[^\"]\"", value) == 1) {
|
||||
setUuid(value);
|
||||
} else {
|
||||
setUuid(NULL);
|
||||
}
|
||||
|
||||
start = strstr(line, "LABEL=") + 6;
|
||||
if (sscanf(start, "\"%127[^\"]\"", value) == 1) {
|
||||
start = strstr(line, "LABEL=");
|
||||
if (start != NULL && sscanf(start + 6, "\"%127[^\"]\"", value) == 1) {
|
||||
setUserLabel(value);
|
||||
} else {
|
||||
setUserLabel(NULL);
|
||||
|
|
Loading…
Reference in a new issue