diff options
Diffstat (limited to 'modutils/modprobe-small.c')
| -rw-r--r-- | modutils/modprobe-small.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c index 31a215a29..7f584102d 100644 --- a/modutils/modprobe-small.c +++ b/modutils/modprobe-small.c | |||
| @@ -723,7 +723,7 @@ static int process_module(char *name, const char *cmdline_options) | |||
| 723 | 723 | ||
| 724 | options = NULL; | 724 | options = NULL; |
| 725 | if (!is_remove) { | 725 | if (!is_remove) { |
| 726 | char *opt_filename = xasprintf("/etc/modules/%s", name); | 726 | char *opt_filename = concat_path_file("/etc/modules", name); |
| 727 | options = xmalloc_open_read_close(opt_filename, NULL); | 727 | options = xmalloc_open_read_close(opt_filename, NULL); |
| 728 | if (options) | 728 | if (options) |
| 729 | replace_char(options, '\n', ' '); | 729 | replace_char(options, '\n', ' '); |
| @@ -731,10 +731,8 @@ static int process_module(char *name, const char *cmdline_options) | |||
| 731 | if (cmdline_options) { | 731 | if (cmdline_options) { |
| 732 | /* NB: cmdline_options always have one leading ' ' | 732 | /* NB: cmdline_options always have one leading ' ' |
| 733 | * (see main()), we remove it here */ | 733 | * (see main()), we remove it here */ |
| 734 | char *op = xasprintf(options ? "%s %s" : "%s %s" + 3, | 734 | xasprintf_inplace(options, options ? "%s %s" : "%s %s" + 3, |
| 735 | cmdline_options + 1, options); | 735 | cmdline_options + 1, options); |
| 736 | free(options); | ||
| 737 | options = op; | ||
| 738 | } | 736 | } |
| 739 | #endif | 737 | #endif |
| 740 | free(opt_filename); | 738 | free(opt_filename); |
| @@ -1010,9 +1008,7 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv) | |||
| 1010 | char **arg = argv; | 1008 | char **arg = argv; |
| 1011 | while (*++arg) { | 1009 | while (*++arg) { |
| 1012 | /* Enclose options in quotes */ | 1010 | /* Enclose options in quotes */ |
| 1013 | char *s = options; | 1011 | xasprintf_inplace(options, "%s \"%s\"", options ? options : "", *arg); |
| 1014 | options = xasprintf("%s \"%s\"", s ? s : "", *arg); | ||
| 1015 | free(s); | ||
| 1016 | *arg = NULL; | 1012 | *arg = NULL; |
| 1017 | } | 1013 | } |
| 1018 | # else | 1014 | # else |
