aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modutils/modprobe.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c
index 2860ae05d..f339fbdbe 100644
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -80,12 +80,14 @@ static int read_config(const char *path);
80static char *gather_options_str(char *opts, const char *append) 80static char *gather_options_str(char *opts, const char *append)
81{ 81{
82 /* Speed-optimized. We call gather_options_str many times. */ 82 /* Speed-optimized. We call gather_options_str many times. */
83 if (opts == NULL) { 83 if (append) {
84 opts = xstrdup(append); 84 if (opts == NULL) {
85 } else { 85 opts = xstrdup(append);
86 int optlen = strlen(opts); 86 } else {
87 opts = xrealloc(opts, optlen + strlen(append) + 2); 87 int optlen = strlen(opts);
88 sprintf(opts + optlen, " %s", append); 88 opts = xrealloc(opts, optlen + strlen(append) + 2);
89 sprintf(opts + optlen, " %s", append);
90 }
89 } 91 }
90 return opts; 92 return opts;
91} 93}