[PATCH 03/16] command: Allow setting a NULL hook function

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

 



This allows a caller to unset a hook function for an existing virCommand
instance. Will be used in storage_backend.c

Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
---
 src/util/command.c |    2 +-
 src/util/command.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/command.c b/src/util/command.c
index 78586e8..fa6425d 100644
--- a/src/util/command.c
+++ b/src/util/command.c
@@ -723,7 +723,7 @@ virCommandSetPreExecHook(virCommandPtr cmd, virExecHook hook, void *opaque)
     if (!cmd || cmd->has_error)
         return;
 
-    if (cmd->hook) {
+    if (cmd->hook && hook) {
         cmd->has_error = -1;
         VIR_DEBUG0("cannot specify hook twice");
         return;
diff --git a/src/util/command.h b/src/util/command.h
index aa5136b..b16bc27 100644
--- a/src/util/command.h
+++ b/src/util/command.h
@@ -229,7 +229,7 @@ void virCommandSetErrorFD(virCommandPtr cmd,
  */
 void virCommandSetPreExecHook(virCommandPtr cmd,
                               virExecHook hook,
-                              void *opaque) ATTRIBUTE_NONNULL(2);
+                              void *opaque);
 
 /*
  * Call after adding all arguments and environment settings, but before
-- 
1.7.4.4

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