]> xenbits.xensource.com Git - libvirt.git/commitdiff
group ownership of /var/run/libvirt/
authorDaniel Veillard <veillard@redhat.com>
Fri, 25 Apr 2008 15:46:46 +0000 (15:46 +0000)
committerDaniel Veillard <veillard@redhat.com>
Fri, 25 Apr 2008 15:46:46 +0000 (15:46 +0000)
* qemud/qemud.c: applied patch from Anton Protopopov to change
  group ownership of /var/run/libvirt/ to unix_sock_gid.
Daniel

ChangeLog
qemud/qemud.c

index abe6dc42a07a215b350483c46cc820b76f7bc803..dc02c43038446cd2ffd19636e2046a2e7cf0a099 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Apr 25 17:44:28 CEST 2008 Daniel Veillard <veillard@redhat.com>
+
+       * qemud/qemud.c: applied patch from Anton Protopopov to change
+         group ownership of /var/run/libvirt/ to unix_sock_gid.
+
 Fri Apr 25 16:51:58 CEST 2008 Jim Meyering <meyering@redhat.com>
 
        avoid problems with sign-extended "char" operand to is* functions
index 23af04242d8f0773f250e2ece915710545625b27..a7b27ee5448f25c953067c45f91bcdcb1e2760fc 100644 (file)
@@ -2156,6 +2156,18 @@ int main(int argc, char **argv) {
     if (remoteReadConfigFile (server, remote_config_file) < 0)
         goto error1;
 
+    /* Change the group ownership of /var/run/libvirt to unix_sock_gid */
+    if (getuid() != 0) {
+        qemudLog (QEMUD_WARN,
+                  "%s", _("Cannot set group ownership when not running as root"));
+    } else {
+        const char *sockdirname = LOCAL_STATE_DIR "/run/libvirt";
+
+        if (chown(sockdirname, -1, unix_sock_gid) < 0)
+            qemudLog(QEMUD_ERR, "%s %s",
+                    _("Failed to change group ownership of "), sockdirname);
+    }
+
     if (godaemon) {
         openlog("libvirtd", 0, 0);
         if (qemudGoDaemon() < 0) {