[PATCH 1/2] qemuSecurityChownCallback: Remove 'cleanup' section

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Treat the shortcut for chowning local files as a stand-alone section
by returning success from it and refactor the rest so that the cleanup
section is inline.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 570dc059e9..b1f7be50b4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -268,24 +268,20 @@ qemuSecurityChownCallback(const virStorageSource *src,
         }

         if (chown(src->path, uid, gid) < 0)
-            goto cleanup;
-    } else {
-        if (!(cpy = virStorageSourceCopy(src, false)))
-            goto cleanup;
-
-        /* src file init reports errors, return -2 on failure */
-        if (virStorageFileInit(cpy) < 0) {
-            ret = -2;
-            goto cleanup;
-        }
+            return -1;

-        if (virStorageFileChown(cpy, uid, gid) < 0)
-            goto cleanup;
+        return 0;
     }

-    ret = 0;
+    if (!(cpy = virStorageSourceCopy(src, false)))
+        return -1;
+
+    /* src file init reports errors, return -2 on failure */
+    if (virStorageFileInit(cpy) < 0)
+        return -2;
+
+    ret = virStorageFileChown(cpy, uid, gid);

- cleanup:
     save_errno = errno;
     virStorageFileDeinit(cpy);
     errno = save_errno;
-- 
2.24.1





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux