[libvirt] [PATCH] examples: Resurrect domsuspend example

Eric Blake eblake at redhat.com
Mon Dec 16 17:36:57 UTC 2013


On 12/13/2013 07:22 AM, Michal Privoznik wrote:
> This partially reverts 5eb4b04211 and 62774afb6ba8.
> 
> Rewrite the domsuspend example from scratch. This time do it right.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  .gitignore                      |   1 +
>  Makefile.am                     |   4 +-
>  cfg.mk                          |   2 +-
>  configure.ac                    |   1 +
>  examples/domsuspend/Makefile.am |  27 ++++
>  examples/domsuspend/suspend.c   | 276 ++++++++++++++++++++++++++++++++++++++++
>  libvirt.spec.in                 |   3 +-
>  7 files changed, 310 insertions(+), 4 deletions(-)
>  create mode 100644 examples/domsuspend/Makefile.am
>  create mode 100644 examples/domsuspend/suspend.c
> 

> +
> +#include <errno.h>
> +#include <getopt.h>
> +#include <libvirt/libvirt.h>
> +#include <libvirt/virterror.h>
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <string.h>
> +#include <unistd.h>
> +
> +int debug = 0;

Should this variable be marked static?  Also, C guarantees it will be
zero-initialized (whether static or global) without an initializer,
because it is not automatic scope.

> +        case 'h':
> +            print_usage(argv[0]);
> +            exit(EXIT_SUCCESS);
> +            break;

Unreachable break might make Coverity unhappy.


> +
> +    default:
> +        /* In all other states domain can't be suspended */
> +        ERROR("Domain is not state where it can be suspended: %d",

s/not/not in a/

ACK with nits fixed.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20131216/07e5b02b/attachment-0001.sig>


More information about the libvir-list mailing list