render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
c401cc
From 531fd52a6d5dc3ccfc2370ff7c3cd8b44e2a93ab Mon Sep 17 00:00:00 2001
c401cc
Message-Id: <531fd52a6d5dc3ccfc2370ff7c3cd8b44e2a93ab@dist-git>
c401cc
From: Eric Blake <eblake@redhat.com>
c401cc
Date: Wed, 26 Feb 2014 14:55:15 +0100
c401cc
Subject: [PATCH] storage: fix bogus target in gluster volume xml
c401cc
c401cc
https://bugzilla.redhat.com/show_bug.cgi?id=1032370
c401cc
c401cc
Commit 6cd60b6 was flat out broken - it tried to print into the
c401cc
wrong variable.  My testing was obviously too cursory (did the
c401cc
name get a slash added?); valgrind would have caught the error.
c401cc
Thankfully it didn't hit any release.
c401cc
c401cc
Reported by Peter Krempa.
c401cc
c401cc
* src/storage/storage_backend_gluster.c
c401cc
(virStorageBackendGlusterRefreshVol): Fix bogus code.
c401cc
c401cc
Signed-off-by: Eric Blake <eblake@redhat.com>
c401cc
(cherry picked from commit 3a96cebceb1d82cc550bef59250c7da02ac92707)
c401cc
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c401cc
---
c401cc
 src/storage/storage_backend_gluster.c | 4 +++-
c401cc
 1 file changed, 3 insertions(+), 1 deletion(-)
c401cc
c401cc
diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c
c401cc
index 622526b..2ec2424 100644
c401cc
--- a/src/storage/storage_backend_gluster.c
c401cc
+++ b/src/storage/storage_backend_gluster.c
c401cc
@@ -227,14 +227,16 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state,
c401cc
         goto cleanup;
c401cc
 
c401cc
     tmp = state->uri->path;
c401cc
-    if (virAsprintf(&vol->key, "%s%s", state->uri->path, name) < 0) {
c401cc
+    if (virAsprintf(&state->uri->path, "/%s", vol->key) < 0) {
c401cc
         state->uri->path = tmp;
c401cc
         goto cleanup;
c401cc
     }
c401cc
     if (!(vol->target.path = virURIFormat(state->uri))) {
c401cc
+        VIR_FREE(state->uri->path);
c401cc
         state->uri->path = tmp;
c401cc
         goto cleanup;
c401cc
     }
c401cc
+    VIR_FREE(state->uri->path);
c401cc
     state->uri->path = tmp;
c401cc
 
c401cc
     if (S_ISDIR(st->st_mode)) {
c401cc
-- 
c401cc
1.9.0
c401cc