[libvirt] [RFC 1/5]: Return exitstatus from virStorageBackendRunProgRegex

Daniel P. Berrange berrange at redhat.com
Thu Jun 12 14:45:50 UTC 2008


On Thu, Jun 12, 2008 at 04:09:00PM +0200, Chris Lalancette wrote:
> case for this change is in the iSCSI stuff; older versions of iscsiadm tools
> would return a failure when getting the session number, despite the command
> succeeding.

Oh joy :-(


> Index: src/storage_backend.c
> ===================================================================
> RCS file: /data/cvs/libvirt/src/storage_backend.c,v
> retrieving revision 1.14
> diff -u -r1.14 storage_backend.c
> --- a/src/storage_backend.c	6 Jun 2008 11:09:57 -0000	1.14
> +++ b/src/storage_backend.c	12 Jun 2008 13:19:39 -0000
> @@ -352,7 +352,8 @@
>                                const char **regex,
>                                int *nvars,
>                                virStorageBackendListVolRegexFunc func,
> -                              void *data)
> +                              void *data,
> +			      int *outexit)

Whitespace damage

>  {
>      int child = 0, fd = -1, exitstatus, err, failed = 1;
>      FILE *list = NULL;
> @@ -487,12 +488,8 @@
>          return -1;
>      } else {
>          if (WIFEXITED(exitstatus)) {
> -            if (WEXITSTATUS(exitstatus) != 0) {
> -                virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
> -                                      _("non-zero exit status from command %d"),
> -                                      WEXITSTATUS(exitstatus));
> -                return -1;
> -            }
> +			if (outexit != NULL)
> +				*outexit = WEXITSTATUS(exitstatus);


More here. Can you check your $HOME/.emacs file has the magic detailed
in the HACKING file to preserve whitespace.

There's a few more places with problems, but I won't list every single
one here.

Aside from that, the patch looks reasonable.

Regards,
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 :|




More information about the libvir-list mailing list