diff options
author | Doug Ledford <dledford@redhat.com> | 2010-01-11 21:38:14 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-01-18 22:50:26 +0100 |
commit | 4d0b563b5b5597cc1467e3560f87fc3a144223a2 (patch) | |
tree | 5d3a5e8ed1a12f832e49c7c659c55e68bc8db667 /config.c | |
parent | Don't use %02d as a metadata format specifier for metadata numbers. (diff) | |
download | mdadm-4d0b563b5b5597cc1467e3560f87fc3a144223a2.tar.xz mdadm-4d0b563b5b5597cc1467e3560f87fc3a144223a2.zip |
Fix segfault when the AUTO keyword is used in the config file
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -677,12 +677,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); + } } int loaded = 0; |