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.
Signed-off-by: Xinyu Chen <xinyu.chen@freescale.com>
diff --git a/vold/mmc.c b/vold/mmc.c
index fcf7c2f..6ad97f4 100644
--- a/vold/mmc.c
+++ b/vold/mmc.c
@@ -158,6 +158,10 @@
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);