aboutsummaryrefslogtreecommitdiff
path: root/toys/pending
diff options
context:
space:
mode:
authorIsaac Dunham <ibid.ag@gmail.com>2015-08-04 19:34:00 -0700
committerRob Landley <rob@landley.net>2015-08-08 16:59:20 -0500
commit8f1f8ef2a4546cc6089c12fe09735fb0d345c175 (patch)
treecf285ec75a765ff42fbd9ea933549a760e08f5c7 /toys/pending
parentda8ad27856dfc6729dac8b6fe87d595a0eb9ca23 (diff)
downloadtoybox-8f1f8ef2a4546cc6089c12fe09735fb0d345c175.tar.gz
modprobe: use basename_r()
Diffstat (limited to 'toys/pending')
-rw-r--r--toys/pending/modprobe.c6
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];