projects
/
platform
/
upstream
/
toybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
da8ad27
)
modprobe: use basename_r()
author
Isaac Dunham
<ibid.ag@gmail.com>
Wed, 5 Aug 2015 02:34:00 +0000
(19:34 -0700)
committer
Rob Landley
<rob@landley.net>
Sat, 8 Aug 2015 21:59:20 +0000
(16:59 -0500)
toys/pending/modprobe.c
patch
|
blob
|
history
diff --git
a/toys/pending/modprobe.c
b/toys/pending/modprobe.c
index
12d2d78
..
10bd578
100644
(file)
--- 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];