diff options
-rw-r--r-- | modutils/modprobe.c | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c index d5b5dd41b..5e7486a81 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c | |||
@@ -264,8 +264,7 @@ static void include_conf(struct dep_t **first, struct dep_t **current, char *buf | |||
264 | /* handle alias as a module dependent on the aliased module */ | 264 | /* handle alias as a module dependent on the aliased module */ |
265 | if (!*current) { | 265 | if (!*current) { |
266 | (*first) = (*current) = xzalloc(sizeof(struct dep_t)); | 266 | (*first) = (*current) = xzalloc(sizeof(struct dep_t)); |
267 | } | 267 | } else { |
268 | else { | ||
269 | (*current)->m_next = xzalloc(sizeof(struct dep_t)); | 268 | (*current)->m_next = xzalloc(sizeof(struct dep_t)); |
270 | (*current) = (*current)->m_next; | 269 | (*current) = (*current)->m_next; |
271 | } | 270 | } |
@@ -275,16 +274,14 @@ static void include_conf(struct dep_t **first, struct dep_t **current, char *buf | |||
275 | if ((strcmp(mod, "off") == 0) || (strcmp(mod, "null") == 0)) { | 274 | if ((strcmp(mod, "off") == 0) || (strcmp(mod, "null") == 0)) { |
276 | (*current)->m_depcnt = 0; | 275 | (*current)->m_depcnt = 0; |
277 | (*current)->m_deparr = 0; | 276 | (*current)->m_deparr = 0; |
278 | } | 277 | } else { |
279 | else { | ||
280 | (*current)->m_depcnt = 1; | 278 | (*current)->m_depcnt = 1; |
281 | (*current)->m_deparr = xmalloc(1 * sizeof(char *)); | 279 | (*current)->m_deparr = xmalloc(1 * sizeof(char *)); |
282 | (*current)->m_deparr[0] = xstrdup(mod); | 280 | (*current)->m_deparr[0] = xstrdup(mod); |
283 | } | 281 | } |
284 | (*current)->m_next = 0; | 282 | (*current)->m_next = 0; |
285 | } | 283 | } |
286 | } | 284 | } else if ((strncmp(buffer, "options", 7) == 0) && isspace(buffer[7])) { |
287 | else if ((strncmp(buffer, "options", 7) == 0) && isspace(buffer[7])) { | ||
288 | char *mod, *opt; | 285 | char *mod, *opt; |
289 | 286 | ||
290 | /* split the line in the module/alias name, and options */ | 287 | /* split the line in the module/alias name, and options */ |
@@ -307,8 +304,7 @@ static void include_conf(struct dep_t **first, struct dep_t **current, char *buf | |||
307 | } | 304 | } |
308 | } | 305 | } |
309 | } | 306 | } |
310 | } | 307 | } else if ((strncmp(buffer, "include", 7) == 0) && isspace(buffer[7])) { |
311 | else if ((strncmp(buffer, "include", 7) == 0) && isspace(buffer[7])) { | ||
312 | int fdi; char *filename; | 308 | int fdi; char *filename; |
313 | 309 | ||
314 | filename = skip_whitespace(buffer + 8); | 310 | filename = skip_whitespace(buffer + 8); |
@@ -323,7 +319,7 @@ static void include_conf(struct dep_t **first, struct dep_t **current, char *buf | |||
323 | } | 319 | } |
324 | 320 | ||
325 | /* | 321 | /* |
326 | * This function builds a list of dependency rules from /lib/modules/`uname -r`\modules.dep. | 322 | * This function builds a list of dependency rules from /lib/modules/`uname -r`/modules.dep. |
327 | * It then fills every modules and aliases with their default options, found by parsing | 323 | * It then fills every modules and aliases with their default options, found by parsing |
328 | * modprobe.conf (or modules.conf, or conf.modules). | 324 | * modprobe.conf (or modules.conf, or conf.modules). |
329 | */ | 325 | */ |
@@ -411,8 +407,7 @@ static struct dep_t *build_dep(void) | |||
411 | /* enqueue new module */ | 407 | /* enqueue new module */ |
412 | if (!current) { | 408 | if (!current) { |
413 | first = current = xmalloc(sizeof(struct dep_t)); | 409 | first = current = xmalloc(sizeof(struct dep_t)); |
414 | } | 410 | } else { |
415 | else { | ||
416 | current->m_next = xmalloc(sizeof(struct dep_t)); | 411 | current->m_next = xmalloc(sizeof(struct dep_t)); |
417 | current = current->m_next; | 412 | current = current->m_next; |
418 | } | 413 | } |
@@ -425,12 +420,10 @@ static struct dep_t *build_dep(void) | |||
425 | current->m_next = 0; | 420 | current->m_next = 0; |
426 | 421 | ||
427 | p = col + 1; | 422 | p = col + 1; |
428 | } | 423 | } else |
429 | else | ||
430 | /* this line is not a dep description */ | 424 | /* this line is not a dep description */ |
431 | p = 0; | 425 | p = 0; |
432 | } | 426 | } else |
433 | else | ||
434 | /* It's a dep description continuation */ | 427 | /* It's a dep description continuation */ |
435 | p = buffer; | 428 | p = buffer; |
436 | 429 | ||
@@ -454,8 +447,7 @@ static struct dep_t *build_dep(void) | |||
454 | if (next) { | 447 | if (next) { |
455 | *next = 0; | 448 | *next = 0; |
456 | next--; | 449 | next--; |
457 | } | 450 | } else |
458 | else | ||
459 | next = end; | 451 | next = end; |
460 | 452 | ||
461 | /* find the beginning of the module file name */ | 453 | /* find the beginning of the module file name */ |
@@ -648,8 +640,7 @@ static int mod_process(const struct mod_list_t *list, int do_insert) | |||
648 | 640 | ||
649 | if (do_insert) { | 641 | if (do_insert) { |
650 | rc = rc2; /* only last module matters */ | 642 | rc = rc2; /* only last module matters */ |
651 | } | 643 | } else if (!rc2) { |
652 | else if (!rc2) { | ||
653 | rc = 0; /* success if remove any mod */ | 644 | rc = 0; /* success if remove any mod */ |
654 | } | 645 | } |
655 | } | 646 | } |
@@ -747,13 +738,11 @@ static void check_dep(char *mod, struct mod_list_t **head, struct mod_list_t **t | |||
747 | opts = opts->m_next; | 738 | opts = opts->m_next; |
748 | } | 739 | } |
749 | dt = adt; | 740 | dt = adt; |
750 | } | 741 | } else { |
751 | else { | ||
752 | bb_error_msg("module %s not found", mod); | 742 | bb_error_msg("module %s not found", mod); |
753 | return; | 743 | return; |
754 | } | 744 | } |
755 | } | 745 | } else { |
756 | else { | ||
757 | bb_error_msg("bad alias %s", dt->m_name); | 746 | bb_error_msg("bad alias %s", dt->m_name); |
758 | return; | 747 | return; |
759 | } | 748 | } |