Only use RTLD_NODELETE if it's available
authorKen Raeburn <raeburn@mit.edu>
Sun, 3 Apr 2011 06:48:45 +0000 (06:48 +0000)
committerKen Raeburn <raeburn@mit.edu>
Sun, 3 Apr 2011 06:48:45 +0000 (06:48 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24815 dc483132-0cff-0310-8789-dd5450dbe970

src/util/support/plugins.c

index ce65e1bca1b20c3eead6875057e18a3d3e9f7ec2..96b9d948d7d3e3181a2a9eba9841913fb28bf1c2 100644 (file)
@@ -258,12 +258,20 @@ krb5int_open_plugin (const char *filepath, struct plugin_file_handle **h, struct
 #endif /* USE_CFBUNDLE */
 
 #ifdef RTLD_GROUP
-#define PLUGIN_DLOPEN_FLAGS (RTLD_NOW | RTLD_LOCAL | RTLD_GROUP)
+# ifdef RTLD_NODELETE
+#  define PLUGIN_DLOPEN_FLAGS (RTLD_NOW | RTLD_LOCAL | RTLD_GROUP | RTLD_NODELETE)
+# else
+#  define PLUGIN_DLOPEN_FLAGS (RTLD_NOW | RTLD_LOCAL | RTLD_GROUP)
+# endif
 #else
-#define PLUGIN_DLOPEN_FLAGS (RTLD_NOW | RTLD_LOCAL)
+# ifdef RTLD_NODELETE
+#  define PLUGIN_DLOPEN_FLAGS (RTLD_NOW | RTLD_LOCAL | RTLD_NODELETE)
+# else
+#  define PLUGIN_DLOPEN_FLAGS (RTLD_NOW | RTLD_LOCAL)
+# endif
 #endif
         if (!err) {
-            handle = dlopen(filepath, PLUGIN_DLOPEN_FLAGS | RTLD_NODELETE);
+            handle = dlopen(filepath, PLUGIN_DLOPEN_FLAGS);
             if (handle == NULL) {
                 const char *e = dlerror();
                 if (e == NULL)