Fixes kmodloader on systems without stdio and prevents fd leaks in case
descriptor zero is opened.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
struct module *m;
struct stat s;
- if (!fd) {
+ if (fd < 0) {
ULOG_ERR("failed to open %s\n", module);
return NULL;
}
struct stat s;
char *map, *strings;
- if (!fd) {
+ if (fd < 0) {
ULOG_ERR("failed to open %s\n", module);
return -1;
}
}
fd = open(path, O_RDONLY);
- if (!fd) {
+ if (fd < 0) {
ULOG_ERR("cannot open %s\n", path);
return ret;
}