summaryrefslogtreecommitdiff
path: root/toys/pending/modprobe.c
diff options
context:
space:
mode:
Diffstat (limited to 'toys/pending/modprobe.c')
-rwxr-xr-x[-rw-r--r--]toys/pending/modprobe.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/toys/pending/modprobe.c b/toys/pending/modprobe.c
index 07c53fc..5431cb3 100644..100755
--- a/toys/pending/modprobe.c
+++ b/toys/pending/modprobe.c
@@ -65,12 +65,14 @@ struct module_s {
static char *path2mod(char *file, char *mod)
{
int i;
- char *from;
+ char *from, *lslash;
if (!file) return NULL;
if (!mod) mod = xmalloc(MODNAME_LEN);
- from = basename_r(file);
+ lslash = strrchr(file, '/');
+ if (!lslash || (lslash == file && !lslash[1])) from = file;
+ else from = lslash + 1;
for (i = 0; i < (MODNAME_LEN-1) && from[i] && from[i] != '.'; i++)
mod[i] = (from[i] == '-') ? '_' : from[i];
@@ -275,8 +277,7 @@ static int config_action(struct dirtree *node)
get_mod(tokens[1], 1)->flags |= MOD_BLACKLIST;
else if (!strcmp(tokens[0], "install")) continue;
else if (!strcmp(tokens[0], "remove")) continue;
- else if (toys.optflags & FLAG_q)
- error_msg("Invalid option %s found in file %s", tokens[0], filename);
+ else error_msg("Invalid option %s found in file %s", tokens[0], filename);
}
fclose(fc);
free(filename);
@@ -380,6 +381,7 @@ static int ins_mod(char *modules, char *flags)
}
res = syscall(__NR_init_module, buf, len, toybuf);
if (CFG_TOYBOX_FREE && buf != toybuf) free(buf);
+ if (res) perror_exit("failed to load %s ", toys.optargs[0]);
return res;
}
@@ -426,7 +428,7 @@ static int go_probe(struct module_s *m)
int rc = 0, first = 1;
if (!(m->flags & MOD_FNDDEPMOD)) {
- if (!(toys.optflags & FLAG_q))
+ if (!(toys.optflags & FLAG_s))
error_msg("module %s not found in modules.dep", m->name);
return -ENOENT;
}