(no subject)

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

 



>From 4a3765d97c3f5049aa294a4b7b629eabfd9cf04d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@xxxxxxxxxxx>
Date: Mon, 7 Mar 2011 22:22:36 +0100
Subject: [PATCH 1/2] Move rundir creation into separate function

---
 daemon/libvirtd.c |   31 ++++++++++++++++++++-----------
 1 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 452566c..610e7fd 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -3150,6 +3150,24 @@ enum {
     OPT_VERSION = 129
 };
 
+
+/* Ensure the rundir exists (on tmpfs on some systems) */
+static int create_rundir (void)
+{
+    const char *rundir = LOCALSTATEDIR "/run/libvirt";
+    int ret = 0;
+
+    if (mkdir (rundir, 0755)) {
+       if (errno != EEXIST) {
+           char ebuf[1024];
+           VIR_ERROR(_("unable to create rundir %s: %s"), rundir,
+                     virStrerror(errno, ebuf, sizeof(ebuf)));
+           ret = VIR_DAEMON_ERR_RUNDIR;
+       }
+    }
+    return ret;
+}
+
 #define MAX_LISTEN 5
 int main(int argc, char **argv) {
     struct qemud_server *server = NULL;
@@ -3276,17 +3294,8 @@ int main(int argc, char **argv) {
 
     /* Ensure the rundir exists (on tmpfs on some systems) */
     if (geteuid() == 0) {
-        const char *rundir = LOCALSTATEDIR "/run/libvirt";
-
-        if (mkdir (rundir, 0755)) {
-            if (errno != EEXIST) {
-                char ebuf[1024];
-                VIR_ERROR(_("unable to create rundir %s: %s"), rundir,
-                          virStrerror(errno, ebuf, sizeof(ebuf)));
-                ret = VIR_DAEMON_ERR_RUNDIR;
-                goto error;
-            }
-        }
+        if (create_rundir ())
+            goto error;
     }
 
     /* Beyond this point, nothing should rely on using
-- 
1.7.4.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[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]