nss_wrapper: fall back to pragma init/fini for constructor/destructor if possible
authorBjörn Jacke <bjacke@samba.org>
Fri, 30 Oct 2020 14:11:54 +0000 (15:11 +0100)
committerAndreas Schneider <asn@samba.org>
Wed, 4 Nov 2020 15:37:37 +0000 (16:37 +0100)
Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
src/nss_wrapper.c

index 877f6d1897d315b7754b015fb8d6afbd09343534..d43c296f817fefb7f65c1605792000fb0ec04107 100644 (file)
@@ -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;
 
 /*********************************************************