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

[libvirt] [PATCH]util: Refresh virHook before checking its existence



From: Chen Hanxiao <chenhanxiao cn fujitsu com>

We refresh the status of hook scripts
only when start/stop libvirt, or reload its configuration.
But the status of hooks scripts may be changed.
We need to refresh its status before checking its existence.

Signed-off-by: Chen Hanxiao <chenhanxiao cn fujitsu com>
---
 src/util/virhook.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/util/virhook.c b/src/util/virhook.c
index 159efdb..5500f62 100644
--- a/src/util/virhook.c
+++ b/src/util/virhook.c
@@ -170,11 +170,15 @@ virHookPresent(int driver) {
     if ((driver < VIR_HOOK_DRIVER_DAEMON) ||
         (driver >= VIR_HOOK_DRIVER_LAST))
         return 0;
-    if (virHooksFound == -1)
-        return 0;
+    if (virHookInitialize() > 0) {
+        if (virHooksFound == -1)
+            return 0;
 
-    if ((virHooksFound & (1 << driver)) == 0)
+        if ((virHooksFound & (1 << driver)) == 0)
+            return 0;
+    } else {
         return 0;
+    }
     return 1;
 }
 
-- 
1.8.2.1


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