[PATCH] insmod, modprobe: propagate error status from module insertion to exit code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



insmod and modprobe return STATUS_FAILURE when module insertion fails,
regardless of the reason. Since distinguishing between specific failure
cases might be useful for callers of these utilities, it makes sense to
propagate the error code from insertion to the exit status.

Signed-off-by: Daniel Dadap <ddadap@xxxxxxxxxx>
Reviewed-by:   Andy Ritger  <aritger@xxxxxxxxxx>
---
 tools/insmod.c   | 2 +-
 tools/modprobe.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/insmod.c b/tools/insmod.c
index 427495a..b8c1520 100644
--- a/tools/insmod.c
+++ b/tools/insmod.c
@@ -148,7 +148,7 @@ static int do_insmod(int argc, char *argv[])
 end:
 	kmod_unref(ctx);
 	free(opts);
-	return err >= 0 ? EXIT_SUCCESS : EXIT_FAILURE;
+	return err >= 0 ? EXIT_SUCCESS : -err;
 }

 const struct kmod_cmd kmod_cmd_compat_insmod = {
diff --git a/tools/modprobe.c b/tools/modprobe.c
index 437dea3..ec294e0 100644
--- a/tools/modprobe.c
+++ b/tools/modprobe.c
@@ -929,7 +929,7 @@ done:

 	free(config_paths);

-	return err >= 0 ? EXIT_SUCCESS : EXIT_FAILURE;
+	return err >= 0 ? EXIT_SUCCESS : -err;
 }

 const struct kmod_cmd kmod_cmd_compat_modprobe = {
-- 1.8.0.2


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux