File module-init-tools-options-priority.diff of Package module-init-tools
---
modprobe.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
--- modprobe.c.orig
+++ modprobe.c
@@ -805,6 +805,20 @@ static char *append_option(char *options
return options;
}
+static char *prepend_option(char *options, const char *newoption)
+{
+ size_t l1, l2;
+ l1 = strlen(options);
+ l2 = strlen(newoption);
+ /* the resulting string will look like
+ * newoption + ' ' + options + '\0' */
+ options = NOFAIL(realloc(options, l2 + 1 + l1 + 1));
+ memmove(options + l2 + 1, options, l1 + 1);
+ options[l2] = ' ';
+ memcpy(options, newoption, l2);
+ return options;
+}
+
/* Add to options */
static char *add_extra_options(const char *modname,
char *optstring,
@@ -812,7 +826,7 @@ static char *add_extra_options(const cha
{
while (options) {
if (strcmp(options->modulename, modname) == 0)
- optstring = append_option(optstring, options->options);
+ optstring = prepend_option(optstring, options->options);
options = options->next;
}
return optstring;