Merge change 11205

* changes:
  Fix bug of mmc.c not checking read_file result. This bug causes segment fault when reading name node of SDIO mmc device's /sys file, which is not existed at all.
This commit is contained in:
Android Code Review 2009-08-21 14:50:15 -07:00
commit 41ced0261c
1 changed files with 4 additions and 0 deletions

View File

@ -158,6 +158,10 @@ static int mmc_bootstrap_card(char *sysfs_path)
sprintf(filename, "/sys%s/name", devpath);
p = read_file(filename, &sz);
if (!p) {
LOGE("Unable to read MMC name: %s", filename);
return -errno;
}
p[strlen(p) - 1] = '\0';
sprintf(tmp, "MMC_NAME=%s", p);
free(p);