};
static bool all;
-static int instance;
static const char *instance_name;
static const char * const pause_usage[] = {
int kvm_cmd_pause(int argc, const char **argv, const char *prefix)
{
+ int instance;
+ int r;
+
parse_pause_options(argc, argv);
if (all)
return kvm__enumerate_instances(do_pause);
- if (instance_name == NULL &&
- instance == 0)
+ if (instance_name == NULL)
kvm_pause_help();
- if (instance_name)
- instance = kvm__get_sock_by_instance(instance_name);
+ instance = kvm__get_sock_by_instance(instance_name);
if (instance <= 0)
die("Failed locating instance");
- return do_pause(instance_name, instance);
+ r = do_pause(instance_name, instance);
+
+ close(instance);
+
+ return r;
}