[PATCH 2/2] rmmod (modprobe-small): error on nonexistent module
Federico Vaga
federico.vaga at gmail.com
Sat Jul 9 16:00:52 UTC 2011
No error is displayed when you try to unload a nonexistent module; only if
debug mode is active a message is showed. It can be a problem because on
missed typeing error busybox do not return error and it might be thought that
the real module is removed, but it not and it might be a problem.
Signed-off-by: Federico Vaga <federico.vaga at gmail.com>
---
modutils/modprobe-small.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c
index 57b83c0..3952029 100644
--- a/modutils/modprobe-small.c
+++ b/modutils/modprobe-small.c
@@ -531,9 +531,13 @@ static void process_module(char *name, const char *cmdline_options)
replace(name, '-', '_');
dbg1_error_msg("already_loaded:%d is_rmmod:%d", already_loaded(name), is_rmmod);
- if (already_loaded(name) != is_rmmod) {
- dbg1_error_msg("nothing to do for '%s'", name);
- return;
+ if (already_loaded(name) && !is_rmmod) {
+ dbg1_error_msg("nothing to do for '%s'", name);
+ return;
+ }
+ if (!already_loaded(name) && is_rmmod) {
+ bb_error_msg("nothing to do for '%s'", name);
+ return;
}
options = NULL;
--
1.7.6
More information about the busybox
mailing list