Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e3530471 authored by Xinyu Chen's avatar Xinyu Chen
Browse files

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: default avatarXinyu Chen <xinyu.chen@freescale.com>
parent 227c74af
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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);