mirror of git://git.suckless.org/ubase
rmmod: fix segfault if '.' is not found
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
This commit is contained in:
parent
acdac11285
commit
dfc2f7edac
2
rmmod.c
2
rmmod.c
|
@ -38,7 +38,7 @@ main(int argc, char *argv[])
|
||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < argc; i++) {
|
||||||
mod = argv[i];
|
mod = argv[i];
|
||||||
p = strrchr(mod, '.');
|
p = strrchr(mod, '.');
|
||||||
if (strlen(p) == 3 && !strcmp(p, ".ko"))
|
if (p && !strcmp(p, ".ko"))
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
if (syscall(__NR_delete_module, mod, flags) < 0)
|
if (syscall(__NR_delete_module, mod, flags) < 0)
|
||||||
eprintf("delete_module:");
|
eprintf("delete_module:");
|
||||||
|
|
Loading…
Reference in New Issue