[BusyBox-cvs] CVS update of busybox/modutils (modprobe.c)
Erik Andersen
andersen at codepoet.org
Tue Aug 3 08:23:33 UTC 2004
Date: Tuesday, August 3, 2004 @ 02:23:33
Author: andersen
Path: /var/cvs/busybox/modutils
Modified: modprobe.c (1.33 -> 1.34)
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
Index: busybox/modutils/modprobe.c
diff -u busybox/modutils/modprobe.c:1.33 busybox/modutils/modprobe.c:1.34
--- busybox/modutils/modprobe.c:1.33 Wed Jul 21 18:03:39 2004
+++ busybox/modutils/modprobe.c Tue Aug 3 02:23:33 2004
@@ -368,15 +368,14 @@
#define MODULE_EXTENSION ".o"
#define MOD_EXTENSION_LEN 2
#endif
- if ((strstr (mod_path, mod_name) ==
- (mod_path + strlen(mod_path) -
- strlen(mod_name) - MOD_EXTENSION_LEN))
- && (!strcmp(mod_path + strlen(mod_path) -
- MOD_EXTENSION_LEN, MODULE_EXTENSION)))
- {
- return 1;
- }
- return 0;
+ /* last path component */
+ const char *last_comp = strrchr (mod_path, '/');
+
+ return (strncmp(last_comp ? last_comp + 1 : mod_path,
+ mod_name,
+ strlen(mod_name)) == 0 ) &&
+ (strcmp(mod_path + strlen(mod_path) -
+ MOD_EXTENSION_LEN, MODULE_EXTENSION) == 0);
}
/* return 1 = loaded, 0 = not loaded, -1 = can't tell */
@@ -409,7 +408,7 @@
static int mod_process ( struct mod_list_t *list, int do_insert )
{
char lcmd [256];
- int rc = 1;
+ int rc = 0;
while ( list ) {
*lcmd = '\0';
More information about the busybox-cvs
mailing list