diff options
Diffstat (limited to 'toys/pending/modprobe.c')
-rw-r--r-- | toys/pending/modprobe.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/toys/pending/modprobe.c b/toys/pending/modprobe.c index 12d2d783..10bd5780 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]; |