[SCM] NSS Wrapper Repository - branch master updated

Andreas Schneider asn at samba.org
Wed Nov 4 15:38:20 UTC 2020


The branch, master has been updated
       via  0884724 nss_wrapper: fall back to pragma init/fini for constructor/destructor if possible
       via  fed22a4 configure: check for pragma init/fini for constructors/destructors
      from  7bdf2f8 nwrap_files_cache_reload: add close for ebadf fd just incase

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


- Log -----------------------------------------------------------------
commit 0884724ec2016cf19f8cb81c1e527cde6f747955
Author: Björn Jacke <bjacke at samba.org>
Date:   Fri Oct 30 15:11:54 2020 +0100

    nss_wrapper: fall back to pragma init/fini for constructor/destructor if possible
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit fed22a4ebadaffdefa9e2cf52e7de955e8532369
Author: Björn Jacke <bjacke at samba.org>
Date:   Fri Oct 30 15:05:36 2020 +0100

    configure: check for pragma init/fini for constructors/destructors
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

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

Summary of changes:
 ConfigureChecks.cmake | 26 ++++++++++++++++++++++++++
 config.h.cmake        |  2 ++
 src/nss_wrapper.c     |  7 +++++++
 3 files changed, 35 insertions(+)


Changeset truncated at 500 lines:

diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 30510d8..5bd69db 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -263,6 +263,32 @@ int main(void) {
     return 0;
 }" HAVE_DESTRUCTOR_ATTRIBUTE)
 
+check_c_source_compiles("
+#pragma init (test_constructor)
+void test_constructor(void);
+
+void test_constructor(void)
+{
+     return;
+}
+
+int main(void) {
+     return 0;
+}" HAVE_PRAGMA_INIT)
+
+check_c_source_compiles("
+#pragma fini (test_destructor)
+void test_destructor(void);
+
+void test_destructor(void)
+{
+    return;
+}
+
+int main(void) {
+    return 0;
+}" HAVE_PRAGMA_FINI)
+
 find_library(DLFCN_LIBRARY dl)
 if (DLFCN_LIBRARY)
     list(APPEND _REQUIRED_LIBRARIES ${DLFCN_LIBRARY})
diff --git a/config.h.cmake b/config.h.cmake
index 41b2531..6199962 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -104,6 +104,8 @@
 #cmakedefine HAVE_ATTRIBUTE_PRINTF_FORMAT 1
 #cmakedefine HAVE_CONSTRUCTOR_ATTRIBUTE 1
 #cmakedefine HAVE_DESTRUCTOR_ATTRIBUTE 1
+#cmakedefine HAVE_PRAGMA_INIT 1
+#cmakedefine HAVE_PRAGMA_FINI 1
 
 /*************************** ENDIAN *****************************/
 
diff --git a/src/nss_wrapper.c b/src/nss_wrapper.c
index 877f6d1..d43c296 100644
--- a/src/nss_wrapper.c
+++ b/src/nss_wrapper.c
@@ -1070,7 +1070,14 @@ static struct nwrap_he nwrap_he_global;
 
 static bool nwrap_gr_parse_line(struct nwrap_cache *nwrap, char *line);
 static void nwrap_gr_unload(struct nwrap_cache *nwrap);
+#if ! defined(HAVE_CONSTRUCTOR_ATTRIBUTE) && defined(HAVE_PRAGMA_INIT)
+/* xlC and other oldschool compilers support (only) this */
+#pragma init (nwrap_constructor)
+#endif
 void nwrap_constructor(void) CONSTRUCTOR_ATTRIBUTE;
+#if ! defined(HAVE_DESTRUCTOR_ATTRIBUTE) && defined(HAVE_PRAGMA_FINI)
+#pragma fini (nwrap_destructor)
+#endif
 void nwrap_destructor(void) DESTRUCTOR_ATTRIBUTE;
 
 /*********************************************************


-- 
NSS Wrapper Repository



More information about the samba-cvs mailing list