[SCM] NSS Wrapper Repository - branch master updated

Andreas Schneider asn at samba.org
Fri Dec 20 05:33:50 MST 2013


The branch, master has been updated
       via  21bce5e cmake: Add a valgrind suppression file.
       via  f6545a3 nwrap: Don't call close on a fd of -1.
       via  75ac11b nwrap: Fix loading the system libraries.
      from  6169a63 tests: Add missing includes for test_nwrap_disabled.

http://gitweb.samba.org/?p=nss_wrapper.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 21bce5e006babe632e7587cad903a922bb4ef5ce
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Dec 20 13:33:29 2013 +0100

    cmake: Add a valgrind suppression file.

commit f6545a35c447dbd94efe6374ac55a41d92b787b1
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Dec 20 13:32:50 2013 +0100

    nwrap: Don't call close on a fd of -1.
    
    valgrind complains about it.

commit 75ac11b6f109d438e2b0c08d534c2069caa5d06b
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Dec 20 13:21:31 2013 +0100

    nwrap: Fix loading the system libraries.
    
    Thanks metze!

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

Summary of changes:
 src/nss_wrapper.c   |   21 ++++++++++++---------
 tests/valgrind.supp |   15 +++++++++++++++
 2 files changed, 27 insertions(+), 9 deletions(-)
 create mode 100644 tests/valgrind.supp


Changeset truncated at 500 lines:

diff --git a/src/nss_wrapper.c b/src/nss_wrapper.c
index 6b50c68..829453e 100644
--- a/src/nss_wrapper.c
+++ b/src/nss_wrapper.c
@@ -565,6 +565,7 @@ static void *nwrap_load_lib_handle(enum nwrap_lib lib)
 	switch (lib) {
 	case NWRAP_LIBNSL:
 #ifdef HAVE_LIBNSL
+		handle = nwrap_main_global->libc->nsl_handle;
 		if (handle == NULL) {
 			for (handle = NULL, i = 10; handle == NULL && i >= 0; i--) {
 				char soname[256] = {0};
@@ -574,14 +575,13 @@ static void *nwrap_load_lib_handle(enum nwrap_lib lib)
 			}
 
 			nwrap_main_global->libc->nsl_handle = handle;
-		} else {
-			handle = nwrap_main_global->libc->nsl_handle;
 		}
 		break;
 #endif
 		/* FALL TROUGH */
 	case NWRAP_LIBSOCKET:
 #ifdef HAVE_LIBSOCKET
+		handle = nwrap_main_global->libc->sock_handle;
 		if (handle == NULL) {
 			for (handle = NULL, i = 10; handle == NULL && i >= 0; i--) {
 				char soname[256] = {0};
@@ -591,13 +591,12 @@ static void *nwrap_load_lib_handle(enum nwrap_lib lib)
 			}
 
 			nwrap_main_global->libc->sock_handle = handle;
-		} else {
-			handle = nwrap_main_global->libc->sock_handle;
 		}
 		break;
 #endif
 		/* FALL TROUGH */
 	case NWRAP_LIBC:
+		handle = nwrap_main_global->libc->handle;
 		if (handle == NULL) {
 			for (handle = NULL, i = 10; handle == NULL && i >= 0; i--) {
 				char soname[256] = {0};
@@ -607,8 +606,6 @@ static void *nwrap_load_lib_handle(enum nwrap_lib lib)
 			}
 
 			nwrap_main_global->libc->handle = handle;
-		} else {
-			handle = nwrap_main_global->libc->handle;
 		}
 		break;
 	}
@@ -4184,7 +4181,9 @@ void nwrap_destructor(void)
 		struct nwrap_cache *c = nwrap_pw_global.cache;
 
 		nwrap_files_cache_unload(c);
-		close(c->fd);
+		if (c->fd > 0) {
+			close(c->fd);
+		}
 
 		SAFE_FREE(nwrap_pw_global.list);
 		nwrap_pw_global.num = 0;
@@ -4194,7 +4193,9 @@ void nwrap_destructor(void)
 		struct nwrap_cache *c = nwrap_gr_global.cache;
 
 		nwrap_files_cache_unload(c);
-		close(c->fd);
+		if (c->fd > 0) {
+			close(c->fd);
+		}
 
 		SAFE_FREE(nwrap_gr_global.list);
 		nwrap_pw_global.num = 0;
@@ -4204,7 +4205,9 @@ void nwrap_destructor(void)
 		struct nwrap_cache *c = nwrap_he_global.cache;
 
 		nwrap_files_cache_unload(c);
-		close(c->fd);
+		if (c->fd > 0) {
+			close(c->fd);
+		}
 
 		SAFE_FREE(nwrap_he_global.list);
 		nwrap_he_global.num = 0;
diff --git a/tests/valgrind.supp b/tests/valgrind.supp
new file mode 100644
index 0000000..95c980b
--- /dev/null
+++ b/tests/valgrind.supp
@@ -0,0 +1,15 @@
+### GLIBC
+
+{
+   glibc_dlopen_worker_alloc
+   Memcheck:Leak
+   fun:*alloc
+   ...
+   fun:dl_open_worker
+   fun:_dl_catch_error
+   fun:_dl_open
+   fun:dlopen_doit
+   fun:_dl_catch_error
+   fun:_dlerror_run
+   fun:dlopen@@GLIBC_2.2.5
+}


-- 
NSS Wrapper Repository


More information about the samba-cvs mailing list