From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fabio M. Di Nitto Date: Wed, 23 Nov 2011 11:15:26 +0100 Subject: [Cluster-devel] [PATCH 07/41] cman_tool: make cman_error static and make it use it's arg instead of global errno In-Reply-To: <1322043360-17037-1-git-send-email-fdinitto@redhat.com> References: <1322043360-17037-1-git-send-email-fdinitto@redhat.com> Message-ID: <85cdd24d35d4b93f6e02c8eef1e84264e3ec1391.1322043045.git.fdinitto@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Spotted by Coverity Scan Signed-off-by: Fabio M. Di Nitto --- :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 #include #include -#include #include #include #include @@ -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 #include #include #include 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 #include #include #include @@ -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