lkml.org 
[lkml]   [2013]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/6] kvm tools: Return error status in lkvm list
Date
Currently list always returns 0, even if there was an error. Instead
have it accumulate any errors and return that.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
tools/kvm/builtin-list.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/kvm/builtin-list.c b/tools/kvm/builtin-list.c
index 9299f17..c35be93 100644
--- a/tools/kvm/builtin-list.c
+++ b/tools/kvm/builtin-list.c
@@ -123,7 +123,7 @@ static void parse_setup_options(int argc, const char **argv)

int kvm_cmd_list(int argc, const char **argv, const char *prefix)
{
- int r;
+ int status, r;

parse_setup_options(argc, argv);

@@ -133,17 +133,23 @@ int kvm_cmd_list(int argc, const char **argv, const char *prefix)
printf("%6s %-20s %s\n", "PID", "NAME", "STATE");
printf("------------------------------------\n");

+ status = 0;
+
if (run) {
r = kvm_list_running_instances();
if (r < 0)
perror("Error listing instances");
+
+ status |= r;
}

if (rootfs) {
r = kvm_list_rootfs();
if (r < 0)
perror("Error listing rootfs");
+
+ status |= r;
}

- return 0;
+ return status;
}
--
1.7.10.4


\
 
 \ /
  Last update: 2013-02-06 10:21    [W:0.167 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site