[PATCHES] improved error reporting in ctdbd_init_connection

Michael Adam obnox at samba.org
Fri Jun 26 05:21:46 MDT 2015


see attached..

review/push appreciated!

Thanks - Michael
-------------- next part --------------
From 608a59535a64140f6e35722fab0bfcacfdec89cc Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Fri, 26 Jun 2015 13:14:39 +0200
Subject: [PATCH 1/2] ctdbd_conn: lower the debug level 0 for failing
 connection to ctdbd.

If e.g. samba fails to start because it can not open the
connection to ctdbd, we want to see some indication in the
logs about this.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 source3/lib/ctdbd_conn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index 7a95b79c..a2443d02 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -459,7 +459,7 @@ static NTSTATUS ctdbd_init_connection(TALLOC_CTX *mem_ctx,
 	ret = ctdbd_connect(&conn->fd);
 	if (ret != 0) {
 		status = map_nt_error_from_unix(errno);
-		DEBUG(10, ("ctdbd_connect failed: %s\n", strerror(errno)));
+		DEBUG(0, ("ctdbd_connect failed: %s\n", strerror(errno)));
 		goto fail;
 	}
 	talloc_set_destructor(conn, ctdbd_connection_destructor);
-- 
2.4.3


From b065aa7db944e481e61b855836abb0064a26804c Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Fri, 26 Jun 2015 13:17:01 +0200
Subject: [PATCH 2/2] ctdbd_conn: use the right error code from ctdbd_connect
 for debug and return

ctdbd_connect() explicitly returns the errno.
Using errno instead of ret misses some important
manually set return values and might use the
errno that is changed by close(fd).

Signed-off-by: Michael Adam <obnox at samba.org>
---
 source3/lib/ctdbd_conn.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index a2443d02..b4dc598 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -458,8 +458,8 @@ static NTSTATUS ctdbd_init_connection(TALLOC_CTX *mem_ctx,
 
 	ret = ctdbd_connect(&conn->fd);
 	if (ret != 0) {
-		status = map_nt_error_from_unix(errno);
-		DEBUG(0, ("ctdbd_connect failed: %s\n", strerror(errno)));
+		status = map_nt_error_from_unix(ret);
+		DEBUG(0, ("ctdbd_connect failed: %s\n", strerror(ret)));
 		goto fail;
 	}
 	talloc_set_destructor(conn, ctdbd_connection_destructor);
-- 
2.4.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150626/101bb414/attachment.pgp>


More information about the samba-technical mailing list