[PATCH v2] rmmod.c: update message for ENOENT

Maxin B. John maxin.john at intel.com
Fri Oct 23 15:35:34 UTC 2015


When we try to remove a non-existing module:

$ rmmod nonexisting
rmmod: can't unload 'nonexisting': unknown symbol in module, or unknown
parameter

man page of "delete_module" says:
ENOENT: No module by that name exists.

Update the inconsistent message.

Signed-off-by: Maxin B. John <maxin.john at intel.com>
---
 modutils/rmmod.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modutils/rmmod.c b/modutils/rmmod.c
index f13ff9e..f5f68cf 100644
--- a/modutils/rmmod.c
+++ b/modutils/rmmod.c
@@ -59,7 +59,11 @@ int rmmod_main(int argc UNUSED_PARAM, char **argv)
 		else
 			filename2modname(bname, modname);
 		if (bb_delete_module(modname, flags))
-			bb_error_msg_and_die("can't unload '%s': %s",
+			if (errno == ENOENT)
+                bb_error_msg_and_die("can't unload '%s': it is not loaded now",
+                    modname);
+            else
+                bb_error_msg_and_die("can't unload '%s': %s",
 					modname, moderror(errno));
 	}
 
-- 
2.4.0



More information about the busybox mailing list