- patch from Yann E. Morin: makes modprobe understand shell patterns
(especially '*') in module aliases, such as:
"alias usb:v0582p0075d*dc*dsc*dp*ic*isc*ip* snd_usb_audio"
Fixes bug #889
842162 10244 645924 1498330 16dcda busybox.old-4.1.20060603-1948
842178 10244 645924 1498346 16dcea busybox.new-4.1.20060603-1948
diff --git a/modutils/modprobe.c b/modutils/modprobe.c
index 59c06ee..4446039 100644
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -21,6 +21,7 @@
#include <string.h>
#include <ctype.h>
#include <fcntl.h>
+#include <fnmatch.h>
#include "busybox.h"
struct mod_opt_t { /* one-way list of options to pass to a module */
@@ -721,9 +722,13 @@
struct mod_opt_t *opt = 0;
char *path = 0;
- // check dependencies
+ /* Search for the given module name amongst all dependency rules.
+ * The module name in a dependency rule can be a shell pattern,
+ * so try to match the given module name against such a pattern.
+ * Of course if the name in the dependency rule is a plain string,
+ * then we consider it a pattern, and matching will still work. */
for ( dt = depend; dt; dt = dt-> m_next ) {
- if ( strcmp ( dt-> m_name, mod ) == 0) {
+ if ( fnmatch ( dt-> m_name, mod, 0 ) == 0) {
break;
}
}