From 1229ef493fe003c624307fb89c90c55f58f275ac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Mon, 30 Jun 2014 15:16:33 +0200
Subject: [PATCH] Track privileged state in udev nodedev driver

Remember if libvirtd is running as root or not.
---
 src/node_device/node_device_udev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index bb6a0b90fa..50bb952bcb 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -53,6 +53,7 @@ VIR_LOG_INIT("node_device.node_device_udev");
 struct _udevPrivate {
     struct udev_monitor *udev_monitor;
     int watch;
+    bool privileged;
 };
 
 static virNodeDeviceDriverStatePtr driverState = NULL;
@@ -1712,7 +1713,7 @@ static int udevSetupSystemDev(void)
     return ret;
 }
 
-static int nodeStateInitialize(bool privileged ATTRIBUTE_UNUSED,
+static int nodeStateInitialize(bool privileged,
                                virStateInhibitCallback callback ATTRIBUTE_UNUSED,
                                void *opaque ATTRIBUTE_UNUSED)
 {
@@ -1746,6 +1747,7 @@ static int nodeStateInitialize(bool privileged ATTRIBUTE_UNUSED,
     }
 
     priv->watch = -1;
+    priv->privileged = privileged;
 
     if (VIR_ALLOC(driverState) < 0) {
         VIR_FREE(priv);
-- 
GitLab