diff options
author | Isaac Dunham <ibid.ag@gmail.com> | 2015-08-04 19:34:00 -0700 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2015-08-08 16:59:20 -0500 |
commit | 8f1f8ef2a4546cc6089c12fe09735fb0d345c175 (patch) | |
tree | cf285ec75a765ff42fbd9ea933549a760e08f5c7 /toys | |
parent | da8ad27856dfc6729dac8b6fe87d595a0eb9ca23 (diff) | |
download | toybox-8f1f8ef2a4546cc6089c12fe09735fb0d345c175.tar.gz |
modprobe: use basename_r()
Diffstat (limited to 'toys')
-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]; |