[libvirt] [PATCH] test: Don't overwrite storage volume target path and key

Only generate target path and key when they are not defined in the XML config. --- src/test/test_driver.c | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 6c06cbc..9d22339 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -706,17 +706,21 @@ static int testOpenVolumesForPool(xmlDocPtr xml, goto error; } - if (virAsprintf(&def->target.path, "%s/%s", - pool->def->target.path, - def->name) == -1) { - virReportOOMError(); - goto error; + if (def->target.path == NULL) { + if (virAsprintf(&def->target.path, "%s/%s", + pool->def->target.path, + def->name) == -1) { + virReportOOMError(); + goto error; + } } - def->key = strdup(def->target.path); if (def->key == NULL) { - virReportOOMError(); - goto error; + def->key = strdup(def->target.path); + if (def->key == NULL) { + virReportOOMError(); + goto error; + } } pool->def->allocation += def->allocation; -- 1.7.0.4

On 09/08/2010 04:41 PM, Matthias Bolte wrote:
Only generate target path and key when they are not defined in the XML config. --- src/test/test_driver.c | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 6c06cbc..9d22339 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -706,17 +706,21 @@ static int testOpenVolumesForPool(xmlDocPtr xml, goto error; }
- if (virAsprintf(&def->target.path, "%s/%s", - pool->def->target.path, - def->name) == -1) { - virReportOOMError(); - goto error; + if (def->target.path == NULL) { + if (virAsprintf(&def->target.path, "%s/%s", + pool->def->target.path, + def->name) == -1) { + virReportOOMError(); + goto error; + } }
- def->key = strdup(def->target.path); if (def->key == NULL) { - virReportOOMError(); - goto error; + def->key = strdup(def->target.path); + if (def->key == NULL) { + virReportOOMError(); + goto error; + } }
pool->def->allocation += def->allocation;
ACK - Cole

2010/9/9 Cole Robinson <crobinso@redhat.com>:
On 09/08/2010 04:41 PM, Matthias Bolte wrote:
Only generate target path and key when they are not defined in the XML config. --- src/test/test_driver.c | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 6c06cbc..9d22339 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -706,17 +706,21 @@ static int testOpenVolumesForPool(xmlDocPtr xml, goto error; }
- if (virAsprintf(&def->target.path, "%s/%s", - pool->def->target.path, - def->name) == -1) { - virReportOOMError(); - goto error; + if (def->target.path == NULL) { + if (virAsprintf(&def->target.path, "%s/%s", + pool->def->target.path, + def->name) == -1) { + virReportOOMError(); + goto error; + } }
- def->key = strdup(def->target.path); if (def->key == NULL) { - virReportOOMError(); - goto error; + def->key = strdup(def->target.path); + if (def->key == NULL) { + virReportOOMError(); + goto error; + } }
pool->def->allocation += def->allocation;
ACK
- Cole
Thanks, pushed. Matthias
participants (2)
-
Cole Robinson
-
Matthias Bolte