rmmod: fix bad error message

Before:

    ># busybox_old rmmod gtrhfhdfghdf
    rmmod: can't unload 'gtrhfhdfghdf': unknown symbol in module, or unknown parameter

    After:

    ># busybox rmmod gtrhfhdfghdf
    rmmod: can't unload module 'gtrhfhdfghdf': No such file or directory

function                                             old     new   delta
modprobe_main                                        726     721      -5
do_modprobe                                          599     590      -9
rmmod_main                                           187     169     -18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-32)             Total: -32 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2015-10-24 04:17:04 +02:00
parent 2e9a0662bc
commit cd13974b20
3 changed files with 15 additions and 9 deletions

View File

@ -461,9 +461,8 @@ static int do_modprobe(struct module_entry *m)
rc = bb_delete_module(m2->modname, O_EXCL);
if (rc) {
if (first) {
bb_error_msg("can't unload module %s: %s",
humanly_readable_name(m2),
moderror(rc));
bb_perror_msg("can't unload module %s",
humanly_readable_name(m2));
break;
}
} else {
@ -622,7 +621,7 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
* autoclean will be removed".
*/
if (bb_delete_module(NULL, O_NONBLOCK | O_EXCL) != 0)
bb_perror_msg_and_die("rmmod");
bb_perror_nomsg_and_die();
}
return EXIT_SUCCESS;
}