Fix segfault when the AUTO keyword is used in the config file From: Doug Ledford Signed-off-by: Doug Ledford Signed-off-by: NeilBrown --- config.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/config.c b/config.c index ca863bd..88e449f 100644 --- a/config.c +++ b/config.c @@ -678,12 +678,21 @@ void homehostline(char *line) static char *auto_options = NULL; void autoline(char *line) { + char *w; + if (auto_options) { fprintf(stderr, Name ": AUTO line may only be give once." " Subsequent lines ignored\n"); return; } - auto_options = line; + + auto_options = dl_strdup(line); + dl_init(auto_options); + + for (w=dl_next(line); w != line ; w=dl_next(w)) { + char *w2 = dl_strdup(w); + dl_add(auto_options, w2); + } } static int auto_re_add = 0;