X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fubox.git;a=blobdiff_plain;f=mount_root.c;h=8868e40c68203612f18e0a8e4da27f41d3ff8713;hp=8ebd64eead3556d2cbfa7704083cefa7c3c01274;hb=0588218d4bc58b0e099272338decbe4734f5678b;hpb=4efaee5d71e13e5f64faac703394f717f2857661 diff --git a/mount_root.c b/mount_root.c index 8ebd64e..8868e40 100644 --- a/mount_root.c +++ b/mount_root.c @@ -109,12 +109,16 @@ static char* find_mount(char *mp) while (fgets(line, sizeof(line), fp)) { char *s, *t = strstr(line, " "); - if (!t) + if (!t) { + fclose(fp); return NULL; + } t++; s = strstr(t, " "); - if (!s) + if (!s) { + fclose(fp); return NULL; + } *s = '\0'; if (!strcmp(t, mp)) { @@ -143,13 +147,16 @@ static char* find_mount_point(char *block, char *fs) char *p = &line[len + 1]; char *t = strstr(p, " "); - if (!t) + if (!t) { + fclose(fp); return NULL; + } *t = '\0'; t++; if (fs && strncmp(t, fs, strlen(fs))) { + fclose(fp); ERROR("block is mounted with wrong fs\n"); return NULL; } @@ -582,7 +589,7 @@ static int main_jffs2reset(int argc, char **argv) mp = find_mount_point(mtd, "jffs2"); if (mp) { - LOG("%s is mounted as %s, only ereasing files\n", mtd, mp); + LOG("%s is mounted as %s, only erasing files\n", mtd, mp); foreachdir(mp, handle_rmdir); mount(mp, "/", NULL, MS_REMOUNT, 0); } else {