diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-06-17 20:33:50 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-06-17 20:33:50 +0200 |
commit | 7eaf58d9586404b4d664f23f3c9f335f053db6b0 (patch) | |
tree | 82fbdb8ad224e3d83db4a8cf3ea334982f077a28 /modutils/modprobe.c | |
parent | ee47f6e44f1a33146e26c7410ade10a98f78ead1 (diff) | |
download | busybox-w32-7eaf58d9586404b4d664f23f3c9f335f053db6b0.tar.gz busybox-w32-7eaf58d9586404b4d664f23f3c9f335f053db6b0.tar.bz2 busybox-w32-7eaf58d9586404b4d664f23f3c9f335f053db6b0.zip |
modprobe: do not use ->probed_name blidly
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'modutils/modprobe.c')
-rw-r--r-- | modutils/modprobe.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c index cfc16cb34..bef657929 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c | |||
@@ -220,6 +220,12 @@ static int read_config(const char *path) | |||
220 | config_file_action, NULL, NULL, 1); | 220 | config_file_action, NULL, NULL, 1); |
221 | } | 221 | } |
222 | 222 | ||
223 | static const char *humanly_readable_name(struct module_entry *m) | ||
224 | { | ||
225 | /* probed_name may be NULL. modname always exists. */ | ||
226 | return m->probed_name ? m->probed_name : m->modname; | ||
227 | } | ||
228 | |||
223 | /* Return: similar to bb_init_module: | 229 | /* Return: similar to bb_init_module: |
224 | * 0 on success, | 230 | * 0 on success, |
225 | * -errno on open/read error, | 231 | * -errno on open/read error, |
@@ -234,7 +240,8 @@ static int do_modprobe(struct module_entry *m) | |||
234 | 240 | ||
235 | if (!(m->flags & MODULE_FLAG_FOUND_IN_MODDEP)) { | 241 | if (!(m->flags & MODULE_FLAG_FOUND_IN_MODDEP)) { |
236 | if (!(option_mask32 & INSMOD_OPT_SILENT)) | 242 | if (!(option_mask32 & INSMOD_OPT_SILENT)) |
237 | bb_error_msg("module %s not found in modules.dep", m->probed_name); | 243 | bb_error_msg("module %s not found in modules.dep", |
244 | humanly_readable_name(m)); | ||
238 | return -ENOENT; | 245 | return -ENOENT; |
239 | } | 246 | } |
240 | DBG("do_modprob'ing %s", m->modname); | 247 | DBG("do_modprob'ing %s", m->modname); |
@@ -259,7 +266,7 @@ static int do_modprobe(struct module_entry *m) | |||
259 | if (rc) { | 266 | if (rc) { |
260 | if (first) { | 267 | if (first) { |
261 | bb_error_msg("failed to unload module %s: %s", | 268 | bb_error_msg("failed to unload module %s: %s", |
262 | m2->probed_name ? m2->probed_name : m2->modname, | 269 | humanly_readable_name(m2), |
263 | moderror(rc)); | 270 | moderror(rc)); |
264 | break; | 271 | break; |
265 | } | 272 | } |
@@ -286,7 +293,7 @@ static int do_modprobe(struct module_entry *m) | |||
286 | free(options); | 293 | free(options); |
287 | if (rc) { | 294 | if (rc) { |
288 | bb_error_msg("failed to load module %s (%s): %s", | 295 | bb_error_msg("failed to load module %s (%s): %s", |
289 | m2->probed_name ? m2->probed_name : m2->modname, | 296 | humanly_readable_name(m2), |
290 | fn, | 297 | fn, |
291 | moderror(rc) | 298 | moderror(rc) |
292 | ); | 299 | ); |