diff options
| author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2004-08-03 08:23:33 +0000 |
|---|---|---|
| committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2004-08-03 08:23:33 +0000 |
| commit | 856294d5925e1ba65cd52a71d8c27c7e2e98e117 (patch) | |
| tree | 61adc1fcba8037e3e54414e225b3b91ed18e15a3 /modutils | |
| parent | 3c6bc4553ea4d75f124941564f466c824740e80c (diff) | |
| download | busybox-w32-856294d5925e1ba65cd52a71d8c27c7e2e98e117.tar.gz busybox-w32-856294d5925e1ba65cd52a71d8c27c7e2e98e117.tar.bz2 busybox-w32-856294d5925e1ba65cd52a71d8c27c7e2e98e117.zip | |
William Barsse writes:
fixes two other issues (plus the previous as well) with a 2.4 kernel :
- should be able to modprobe an already loaded module and get 0 return
code :
# modprobe <something> && modprobe <something> && echo "ok" || echo "failed"
....
failed
Well, hope this helps and that I didn't screw up again,
- William
git-svn-id: svn://busybox.net/trunk/busybox@9057 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'modutils')
| -rw-r--r-- | modutils/modprobe.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c index 612e33a9e..e1e451943 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c | |||
| @@ -368,15 +368,14 @@ static int mod_strcmp ( const char *mod_path, const char *mod_name ) | |||
| 368 | #define MODULE_EXTENSION ".o" | 368 | #define MODULE_EXTENSION ".o" |
| 369 | #define MOD_EXTENSION_LEN 2 | 369 | #define MOD_EXTENSION_LEN 2 |
| 370 | #endif | 370 | #endif |
| 371 | if ((strstr (mod_path, mod_name) == | 371 | /* last path component */ |
| 372 | (mod_path + strlen(mod_path) - | 372 | const char *last_comp = strrchr (mod_path, '/'); |
| 373 | strlen(mod_name) - MOD_EXTENSION_LEN)) | 373 | |
| 374 | && (!strcmp(mod_path + strlen(mod_path) - | 374 | return (strncmp(last_comp ? last_comp + 1 : mod_path, |
| 375 | MOD_EXTENSION_LEN, MODULE_EXTENSION))) | 375 | mod_name, |
| 376 | { | 376 | strlen(mod_name)) == 0 ) && |
| 377 | return 1; | 377 | (strcmp(mod_path + strlen(mod_path) - |
| 378 | } | 378 | MOD_EXTENSION_LEN, MODULE_EXTENSION) == 0); |
| 379 | return 0; | ||
| 380 | } | 379 | } |
| 381 | 380 | ||
| 382 | /* return 1 = loaded, 0 = not loaded, -1 = can't tell */ | 381 | /* return 1 = loaded, 0 = not loaded, -1 = can't tell */ |
| @@ -409,7 +408,7 @@ static int already_loaded (const char *name) | |||
| 409 | static int mod_process ( struct mod_list_t *list, int do_insert ) | 408 | static int mod_process ( struct mod_list_t *list, int do_insert ) |
| 410 | { | 409 | { |
| 411 | char lcmd [256]; | 410 | char lcmd [256]; |
| 412 | int rc = 1; | 411 | int rc = 0; |
| 413 | 412 | ||
| 414 | while ( list ) { | 413 | while ( list ) { |
| 415 | *lcmd = '\0'; | 414 | *lcmd = '\0'; |
