summaryrefslogtreecommitdiff
path: root/modutils/rmmod.c
diff options
context:
space:
mode:
authorDenys Vlasenko2015-10-24 04:17:04 +0200
committerDenys Vlasenko2015-10-24 04:17:04 +0200
commitcd13974b201972ffb605e243f63f674e95b99e5c (patch)
treecbc62c9de34aab6065d76074e4369903b98f679b /modutils/rmmod.c
parent2e9a0662bce58b0fe838f7e1e03c35c4765ff3bc (diff)
downloadbusybox-cd13974b201972ffb605e243f63f674e95b99e5c.zip
busybox-cd13974b201972ffb605e243f63f674e95b99e5c.tar.gz
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>
Diffstat (limited to 'modutils/rmmod.c')
-rw-r--r--modutils/rmmod.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/modutils/rmmod.c b/modutils/rmmod.c
index f13ff9e..5c353ef 100644
--- a/modutils/rmmod.c
+++ b/modutils/rmmod.c
@@ -28,7 +28,7 @@
int rmmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int rmmod_main(int argc UNUSED_PARAM, char **argv)
{
- int n;
+ int n, err;
unsigned flags = O_NONBLOCK | O_EXCL;
/* Parse command line. */
@@ -40,7 +40,8 @@ int rmmod_main(int argc UNUSED_PARAM, char **argv)
flags |= O_TRUNC;
if (n & 4) {
/* Unload _all_ unused modules via NULL delete_module() call */
- if (bb_delete_module(NULL, flags) != 0 && errno != EFAULT)
+ err = bb_delete_module(NULL, flags);
+ if (err && err != EFAULT)
bb_perror_msg_and_die("rmmod");
return EXIT_SUCCESS;
}
@@ -58,9 +59,10 @@ int rmmod_main(int argc UNUSED_PARAM, char **argv)
safe_strncpy(modname, bname, MODULE_NAME_LEN);
else
filename2modname(bname, modname);
- if (bb_delete_module(modname, flags))
- bb_error_msg_and_die("can't unload '%s': %s",
- modname, moderror(errno));
+ err = bb_delete_module(modname, flags);
+ if (err)
+ bb_perror_msg_and_die("can't unload module '%s'",
+ modname);
}
return EXIT_SUCCESS;