[tip:tools/kvm] kvm tools: Return error status in lkvm list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  fd84eb7d3f3c6534554938b9fa6d0fa9ff400585
Gitweb:     http://git.kernel.org/tip/fd84eb7d3f3c6534554938b9fa6d0fa9ff400585
Author:     Michael Ellerman <michael@xxxxxxxxxxxxxx>
AuthorDate: Wed, 6 Feb 2013 19:19:11 +1100
Committer:  Pekka Enberg <penberg@xxxxxxxxxx>
CommitDate: Wed, 6 Feb 2013 13:05:23 +0200

kvm tools: Return error status in lkvm list

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@xxxxxxxxxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 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;
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux