[SCM] Samba Shared Repository - branch master updated

Ralph Böhme slow at samba.org
Mon Jul 16 19:12:03 UTC 2018


The branch, master has been updated
       via  8cb9643 dbwrap: determine basename once instead of three times
      from  26fd709 s3-tldap: do not install test_tldap

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 8cb96438bf1540ec76e759135863202bdef6ee35
Author: David Disseldorp <ddiss at samba.org>
Date:   Tue Jul 10 13:35:30 2018 +0200

    dbwrap: determine basename once instead of three times
    
    Currently determined twice in the clear-if-first codepath and once in
    the ctdb code path. Do it once at the top of the function.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Mon Jul 16 21:11:30 CEST 2018 on sn-devel-144

-----------------------------------------------------------------------

Summary of changes:
 source3/lib/dbwrap/dbwrap_open.c | 40 +++++++++++-----------------------------
 1 file changed, 11 insertions(+), 29 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/dbwrap/dbwrap_open.c b/source3/lib/dbwrap/dbwrap_open.c
index a4d5184..e144d98 100644
--- a/source3/lib/dbwrap/dbwrap_open.c
+++ b/source3/lib/dbwrap/dbwrap_open.c
@@ -64,6 +64,7 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
 			   uint64_t dbwrap_flags)
 {
 	struct db_context *result = NULL;
+	const char *base;
 	const char *sockname;
 
 	if (!DBWRAP_LOCK_ORDER_VALID(lock_order)) {
@@ -71,17 +72,16 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
 		return NULL;
 	}
 
+	base = strrchr_m(name, '/');
+	if (base != NULL) {
+		base++;
+	} else {
+		base = name;
+	}
+
 	if (tdb_flags & TDB_CLEAR_IF_FIRST) {
-		const char *base;
 		bool try_readonly = false;
 
-		base = strrchr_m(name, '/');
-		if (base != NULL) {
-			base += 1;
-		} else {
-			base = name;
-		}
-
 		if (dbwrap_flags & DBWRAP_FLAG_OPTIMIZE_READONLY_ACCESS) {
 			try_readonly = true;
 		}
@@ -97,17 +97,9 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
 	}
 
 	if (tdb_flags & TDB_CLEAR_IF_FIRST) {
-		const char *base;
 		bool try_mutex = true;
 		bool require_mutex = false;
 
-		base = strrchr_m(name, '/');
-		if (base != NULL) {
-			base += 1;
-		} else {
-			base = name;
-		}
-
 		try_mutex = lp_parm_bool(-1, "dbwrap_tdb_mutexes", "*", try_mutex);
 		try_mutex = lp_parm_bool(-1, "dbwrap_tdb_mutexes", base, try_mutex);
 
@@ -137,23 +129,14 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
 	sockname = lp_ctdbd_socket();
 
 	if (lp_clustering()) {
-		const char *partname;
-
 		if (!socket_exist(sockname)) {
 			DEBUG(1, ("ctdb socket does not exist - is ctdb not "
 				  "running?\n"));
 			return NULL;
 		}
 
-		/* ctdb only wants the file part of the name */
-		partname = strrchr(name, '/');
-		if (partname) {
-			partname++;
-		} else {
-			partname = name;
-		}
 		/* allow ctdb for individual databases to be disabled */
-		if (lp_parm_bool(-1, "ctdb", partname, True)) {
+		if (lp_parm_bool(-1, "ctdb", base, true)) {
 			struct messaging_context *msg_ctx;
 			struct ctdbd_connection *conn;
 
@@ -165,13 +148,12 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
 			}
 			msg_ctx = server_messaging_context();
 
-			result = db_open_ctdb(mem_ctx, msg_ctx, partname,
+			result = db_open_ctdb(mem_ctx, msg_ctx, base,
 					      hash_size,
 					      tdb_flags, open_flags, mode,
 					      lock_order, dbwrap_flags);
 			if (result == NULL) {
-				DEBUG(0,("failed to attach to ctdb %s\n",
-					 partname));
+				DBG_ERR("failed to attach to ctdb %s\n", base);
 				if (errno == 0) {
 					errno = EIO;
 				}


-- 
Samba Shared Repository



More information about the samba-cvs mailing list