From 8f1f8ef2a4546cc6089c12fe09735fb0d345c175 Mon Sep 17 00:00:00 2001 From: Isaac Dunham Date: Tue, 4 Aug 2015 19:34:00 -0700 Subject: modprobe: use basename_r() --- toys/pending/modprobe.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'toys/pending/modprobe.c') 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]; -- cgit v1.2.3