[PATCH 3/3] quorumtool: fix return codes for show_status and monitor

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

 



From: "Fabio M. Di Nitto" <fdinitto@xxxxxxxxxx>

correct return codes should be:
 1 if node is quorate
 0 if node is not quorate
-1 if there is any error gather info on the node

Signed-off-by: Fabio M. Di Nitto <fdinitto@xxxxxxxxxx>
---
 tools/corosync-quorumtool.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/tools/corosync-quorumtool.c b/tools/corosync-quorumtool.c
index ff13cdf..4be7fd1 100644
--- a/tools/corosync-quorumtool.c
+++ b/tools/corosync-quorumtool.c
@@ -385,13 +385,13 @@ static int show_status(nodeid_format_t nodeid_format, name_format_t name_format)
 	}
 
 quorum_err:
-	if (err < 0) {
-		return err;
+	if (err != CS_OK) {
+		return -1;
 	}
 
 	err = display_quorum_data(is_quorate, 0);
 	if (err != CS_OK) {
-		return err;
+		return -1;
 	}
 	display_nodes_data(nodeid_format, name_format);
 
@@ -403,9 +403,8 @@ static int monitor_status(nodeid_format_t nodeid_format, name_format_t name_form
 	int loop = 0;
 
 	if (q_type == QUORUM_FREE) {
-		show_status(nodeid_format, name_format);
 		printf("\nQuorum is not configured - cannot monitor\n");
-		return 0;
+		return show_status(nodeid_format, name_format);
 	}
 
 	err=quorum_trackstart(q_handle, CS_TRACK_CHANGES);
@@ -435,7 +434,10 @@ static int monitor_status(nodeid_format_t nodeid_format, name_format_t name_form
 	}
 
 quorum_err:
-	return err;
+	if (err != CS_OK) {
+		return -1;
+	}
+	return g_quorate;
 }
 
 static int show_nodes(nodeid_format_t nodeid_format, name_format_t name_format)
-- 
1.7.7.6

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux