[libvirt] [PATCH] util: Make sure virExec hook failures are raised

2010-01-13 Thread Cole Robinson
With the introduction virDispatchError, hook function errors are
never sent through the error callback, so users will never see
these messages.

Fix this by calling virDispatchError after hook failure.

Signed-off-by: Cole Robinson 
---
 src/util/util.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/util/util.c b/src/util/util.c
index ba6b0db..45ca657 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -557,8 +557,11 @@ __virExec(virConnectPtr conn,
 }
 
 if (hook)
-if ((hook)(data) != 0)
+if ((hook)(data) != 0) {
+VIR_DEBUG0("Hook function failed.");
+virDispatchError(NULL);
 _exit(1);
+}
 
 /* The steps above may need todo something privileged, so
  * we delay clearing capabilities until the last minute */
-- 
1.6.5.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] util: Make sure virExec hook failures are raised

2010-01-14 Thread Daniel P. Berrange
On Wed, Jan 13, 2010 at 03:50:07PM -0500, Cole Robinson wrote:
> With the introduction virDispatchError, hook function errors are
> never sent through the error callback, so users will never see
> these messages.
> 
> Fix this by calling virDispatchError after hook failure.
> 
> Signed-off-by: Cole Robinson 
> ---
>  src/util/util.c |5 -
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/src/util/util.c b/src/util/util.c
> index ba6b0db..45ca657 100644
> --- a/src/util/util.c
> +++ b/src/util/util.c
> @@ -557,8 +557,11 @@ __virExec(virConnectPtr conn,
>  }
>  
>  if (hook)
> -if ((hook)(data) != 0)
> +if ((hook)(data) != 0) {
> +VIR_DEBUG0("Hook function failed.");
> +virDispatchError(NULL);
>  _exit(1);
> +}
>  
>  /* The steps above may need todo something privileged, so
>   * we delay clearing capabilities until the last minute */
> -- 

ACK

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list