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 | |
parent | da8ad27856dfc6729dac8b6fe87d595a0eb9ca23 (diff) | |
download | toybox-8f1f8ef2a4546cc6089c12fe09735fb0d345c175.tar.gz toybox-8f1f8ef2a4546cc6089c12fe09735fb0d345c175.tar.bz2 toybox-8f1f8ef2a4546cc6089c12fe09735fb0d345c175.zip |
modprobe: use basename_r()
-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 12d2d78..10bd578 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]; |