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