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(a)redhat.com>
---
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