In uip_dhcp_get_dns() we try to open /etc/resolv.conf. If we fail to
open it we then SEGV trying to fclose() it.
Fix the code to just return directly if we can't open it.
Acked-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
fp = fopen("/etc/resolv.conf", "r");
if (!fp)
- goto out;
+ return ret;
while (!feof(fp)) {
if (fscanf(fp, "%s %s\n", key, val) != 2)
}
}
-out:
fclose(fp);
return ret;
}