[Cluster-devel] [PATCH 07/41] cman_tool: make cman_error static and make it use it's arg instead of global errno

Fabio M. Di Nitto fdinitto at redhat.com
Wed Nov 23 10:15:26 UTC 2011


Spotted by Coverity Scan

Signed-off-by: Fabio M. Di Nitto <fdinitto at redhat.com>
---
:100644 100644 e1250ee... 60091c9... M	cman/cman_tool/cman_tool.h
:100644 100644 a33c8b4... 872528b... M	cman/cman_tool/join.c
:100644 100644 88612c4... a336c42... M	cman/cman_tool/main.c
 cman/cman_tool/cman_tool.h |    2 --
 cman/cman_tool/join.c      |    1 +
 cman/cman_tool/main.c      |   37 +++++++++++++++++++------------------
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/cman/cman_tool/cman_tool.h b/cman/cman_tool/cman_tool.h
index e1250ee..60091c9 100644
--- a/cman/cman_tool/cman_tool.h
+++ b/cman/cman_tool/cman_tool.h
@@ -12,7 +12,6 @@
 #include <arpa/inet.h>
 #include <net/if.h>
 #include <stdio.h>
-#include <errno.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stddef.h>
@@ -107,6 +106,5 @@ struct commandline
 typedef struct commandline commandline_t;
 
 int join(commandline_t *comline, char *envp[]);
-const char *cman_error(int err);
 
 #endif  /*  __CMAN_TOOL_DOT_H__  */
diff --git a/cman/cman_tool/join.c b/cman/cman_tool/join.c
index a33c8b4..872528b 100644
--- a/cman/cman_tool/join.c
+++ b/cman/cman_tool/join.c
@@ -1,3 +1,4 @@
+#include <errno.h>
 #include <sys/wait.h>
 #include <stdint.h>
 #include <signal.h>
diff --git a/cman/cman_tool/main.c b/cman/cman_tool/main.c
index 88612c4..a336c42 100644
--- a/cman/cman_tool/main.c
+++ b/cman/cman_tool/main.c
@@ -1,3 +1,4 @@
+#include <errno.h>
 #include <inttypes.h>
 #include <unistd.h>
 #include <signal.h>
@@ -194,6 +195,24 @@ static char *membership_state(char *buf, int buflen, int node_state)
 	return buf;
 }
 
+static const char *cman_error(int err)
+{
+	const char *die_error;
+
+	switch (err) {
+	case ENOTCONN:
+		die_error = "Cluster software not started";
+		break;
+	case ENOENT:
+		die_error = "Node is not yet a cluster member";
+		break;
+	default:
+		die_error = strerror(err);
+		break;
+	}
+	return die_error;
+}
+
 static void show_status(void)
 {
 	cman_cluster_t info;
@@ -557,24 +576,6 @@ static int show_services(void)
 }
 
 
-const char *cman_error(int err)
-{
-	const char *die_error;
-
-	switch (errno) {
-	case ENOTCONN:
-		die_error = "Cluster software not started";
-		break;
-	case ENOENT:
-		die_error = "Node is not yet a cluster member";
-		break;
-	default:
-		die_error = strerror(errno);
-		break;
-	}
-	return die_error;
-}
-
 static void leave(commandline_t *comline)
 {
 	cman_handle_t h;
-- 
1.7.4.4




More information about the Cluster-devel mailing list