[PATCH] ctdb: Some build fixes with clang

Volker Lendecke Volker.Lendecke at SerNet.DE
Wed Aug 19 05:37:40 UTC 2015


Hi!

Review&push appreciated!

Thanks,

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From 2bac5f0eca1a3838064788df2ff855c94422a07e Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 19 Aug 2015 07:33:48 +0200
Subject: [PATCH 1/2] ctdb: Fix the build on FreeBSD 10.1

We get sockaddr_in directly in parse_ipv4

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 ctdb/common/system_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ctdb/common/system_util.c b/ctdb/common/system_util.c
index 1ae0bae..663df6e 100644
--- a/ctdb/common/system_util.c
+++ b/ctdb/common/system_util.c
@@ -157,7 +157,7 @@ bool parse_ipv4(const char *s, unsigned port, struct sockaddr_in *sin)
 	}
 
 #ifdef HAVE_SOCK_SIN_LEN
-	sin->ip.sin_len = sizeof(*sin);
+	sin->sin_len = sizeof(*sin);
 #endif
 	return true;
 }
-- 
1.9.1


From 81ba012f0aed29e6d9450523a5285e5ac32711d9 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 19 Aug 2015 07:35:32 +0200
Subject: [PATCH 2/2] ctdb: Fix some clang uninitialized errors

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 ctdb/tools/ctdb.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c
index c6da621..1081eec 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -4914,7 +4914,7 @@ static int control_getreclock(struct ctdb_context *ctdb, int argc, const char **
 static int control_setreclock(struct ctdb_context *ctdb, int argc, const char **argv)
 {
 	int ret;
-	const char *reclock;
+	const char *reclock = NULL;
 
 	if (argc == 0) {
 		reclock = NULL;
@@ -4938,7 +4938,7 @@ static int control_setreclock(struct ctdb_context *ctdb, int argc, const char **
 static int control_setnatgwstate(struct ctdb_context *ctdb, int argc, const char **argv)
 {
 	int ret;
-	uint32_t natgwstate;
+	uint32_t natgwstate = 0;
 
 	if (argc == 0) {
 		usage();
@@ -4967,7 +4967,7 @@ static int control_setnatgwstate(struct ctdb_context *ctdb, int argc, const char
 static int control_setlmasterrole(struct ctdb_context *ctdb, int argc, const char **argv)
 {
 	int ret;
-	uint32_t lmasterrole;
+	uint32_t lmasterrole = 0;
 
 	if (argc == 0) {
 		usage();
@@ -4996,7 +4996,7 @@ static int control_setlmasterrole(struct ctdb_context *ctdb, int argc, const cha
 static int control_setrecmasterrole(struct ctdb_context *ctdb, int argc, const char **argv)
 {
 	int ret;
-	uint32_t recmasterrole;
+	uint32_t recmasterrole = 0;
 
 	if (argc == 0) {
 		usage();
-- 
1.9.1



More information about the samba-technical mailing list