diff options
Diffstat (limited to 'modutils/rmmod.c')
-rw-r--r-- | modutils/rmmod.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/modutils/rmmod.c b/modutils/rmmod.c index f13ff9eb6..5c353ef95 100644 --- a/modutils/rmmod.c +++ b/modutils/rmmod.c | |||
@@ -28,7 +28,7 @@ | |||
28 | int rmmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 28 | int rmmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
29 | int rmmod_main(int argc UNUSED_PARAM, char **argv) | 29 | int rmmod_main(int argc UNUSED_PARAM, char **argv) |
30 | { | 30 | { |
31 | int n; | 31 | int n, err; |
32 | unsigned flags = O_NONBLOCK | O_EXCL; | 32 | unsigned flags = O_NONBLOCK | O_EXCL; |
33 | 33 | ||
34 | /* Parse command line. */ | 34 | /* Parse command line. */ |
@@ -40,7 +40,8 @@ int rmmod_main(int argc UNUSED_PARAM, char **argv) | |||
40 | flags |= O_TRUNC; | 40 | flags |= O_TRUNC; |
41 | if (n & 4) { | 41 | if (n & 4) { |
42 | /* Unload _all_ unused modules via NULL delete_module() call */ | 42 | /* Unload _all_ unused modules via NULL delete_module() call */ |
43 | if (bb_delete_module(NULL, flags) != 0 && errno != EFAULT) | 43 | err = bb_delete_module(NULL, flags); |
44 | if (err && err != EFAULT) | ||
44 | bb_perror_msg_and_die("rmmod"); | 45 | bb_perror_msg_and_die("rmmod"); |
45 | return EXIT_SUCCESS; | 46 | return EXIT_SUCCESS; |
46 | } | 47 | } |
@@ -58,9 +59,10 @@ int rmmod_main(int argc UNUSED_PARAM, char **argv) | |||
58 | safe_strncpy(modname, bname, MODULE_NAME_LEN); | 59 | safe_strncpy(modname, bname, MODULE_NAME_LEN); |
59 | else | 60 | else |
60 | filename2modname(bname, modname); | 61 | filename2modname(bname, modname); |
61 | if (bb_delete_module(modname, flags)) | 62 | err = bb_delete_module(modname, flags); |
62 | bb_error_msg_and_die("can't unload '%s': %s", | 63 | if (err) |
63 | modname, moderror(errno)); | 64 | bb_perror_msg_and_die("can't unload module '%s'", |
65 | modname); | ||
64 | } | 66 | } |
65 | 67 | ||
66 | return EXIT_SUCCESS; | 68 | return EXIT_SUCCESS; |