This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cluster: master - cman: fix cman_tool build warnings spotted byparanoia cflags


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=d0b8e7806f394228329ff797c999a723d89d4d6e
Commit:        d0b8e7806f394228329ff797c999a723d89d4d6e
Parent:        1e648a83f6f5aa0c146ce25e8fd5c47c511077e5
Author:        Fabio M. Di Nitto <fdinitto@redhat.com>
AuthorDate:    Tue May 5 09:02:04 2009 +0200
Committer:     Fabio M. Di Nitto <fdinitto@redhat.com>
CommitterDate: Tue May 5 09:03:53 2009 +0200

cman: fix cman_tool build warnings spotted by paranoia cflags

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
 cman/cman_tool/cman_tool.h |    2 +-
 cman/cman_tool/join.c      |   10 ++++++----
 cman/cman_tool/main.c      |    9 +++++----
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/cman/cman_tool/cman_tool.h b/cman/cman_tool/cman_tool.h
index 7476e1f..3766ee2 100644
--- a/cman/cman_tool/cman_tool.h
+++ b/cman/cman_tool/cman_tool.h
@@ -95,6 +95,6 @@ struct commandline
 typedef struct commandline commandline_t;
 
 int join(commandline_t *comline, char *envp[]);
-char *cman_error(int err);
+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 9c78937..86a69c2 100644
--- a/cman/cman_tool/join.c
+++ b/cman/cman_tool/join.c
@@ -40,7 +40,7 @@ static void be_daemon(int close_stderr)
 }
 
 
-static char *corosync_exit_reason(signed char status)
+static const char *corosync_exit_reason(signed char status)
 {
 	static char reason[256];
 	switch (status) {
@@ -200,10 +200,12 @@ int join(commandline_t *comline, char *main_envp[])
 
 	/* Always run corosync -f because we have already forked twice anyway, and
 	   we want to return any exit code that might happen */
-	argv[0] = "corosync";
-	argv[++argvptr] = "-f";
+	/* also strdup strings because it's otherwise virtually impossible to fix
+	 * build warnings due to the way argv C implementation is done */
+	argv[0] = strdup("corosync");
+	argv[++argvptr] = strdup("-f");
 	if (comline->nosetpri_opt)
-		argv[++argvptr] = "-p";
+		argv[++argvptr] = strdup("-p");
 	argv[++argvptr] = NULL;
 
 	/* Fork/exec cman */
diff --git a/cman/cman_tool/main.c b/cman/cman_tool/main.c
index 450b31c..aef82ac 100644
--- a/cman/cman_tool/main.c
+++ b/cman/cman_tool/main.c
@@ -473,9 +473,9 @@ static int show_services(void)
 }
 
 
-char *cman_error(int err)
+const char *cman_error(int err)
 {
-	char *die_error;
+	const char *die_error;
 
 	switch (errno) {
 	case ENOTCONN:
@@ -696,8 +696,6 @@ static void decode_arguments(int argc, char *argv[], commandline_t *comline)
 	int optchar, i;
 	int show_help = 0;
 
-	comline->config_lcrso=DEFAULT_CONFIG_MODULE;
-
 	while (cont) {
 		optchar = getopt(argc, argv, OPTION_STRING);
 
@@ -837,6 +835,9 @@ static void decode_arguments(int argc, char *argv[], commandline_t *comline)
 		};
 	}
 
+	if (comline->config_lcrso == NULL)
+		comline->config_lcrso = strdup(DEFAULT_CONFIG_MODULE);
+
 	while (optind < argc) {
 		if (strcmp(argv[optind], "join") == 0) {
 			if (comline->operation)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]