X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Futil%2Fsupport%2Fplugins.c;h=c6a9a21d57c71e01ba0936711007c4fa0b3f0652;hb=c2f234c139894aebb32be1238c052b33d03ec2e9;hp=47368be9d49be24250272b91147c64a343021949;hpb=5218de8a2a1c8797fea608e55fa0097fff0e1f34;p=platform%2Fupstream%2Fkrb5.git diff --git a/src/util/support/plugins.c b/src/util/support/plugins.c index 47368be..c6a9a21 100644 --- a/src/util/support/plugins.c +++ b/src/util/support/plugins.c @@ -54,6 +54,20 @@ #define PLUGIN_DLOPEN_FLAGS (RTLD_NOW | RTLD_LOCAL | GROUP | NODELETE) #endif +/* + * glibc bug 11941, fixed in release 2.25, can cause an assertion failure in + * dlclose() on process exit. Our workaround is to leak dlopen() handles + * (which doesn't typically manifest in leak detection tools because the + * handles are still reachable via a global table in libdl). Because we + * dlopen() with RTLD_NODELETE, we weren't going to unload the plugin objects + * anyway. + */ +#ifdef __GLIBC_PREREQ +#if ! __GLIBC_PREREQ(2, 25) +#define dlclose(x) +#endif +#endif + #if USE_DLOPEN && USE_CFBUNDLE #include @@ -175,9 +189,10 @@ long KRB5_CALLCONV krb5int_open_plugin (const char *filepath, struct plugin_file_handle **h, struct errinfo *ep) { long err = 0; - struct stat statbuf; struct plugin_file_handle *htmp = NULL; int got_plugin = 0; +#if defined(USE_CFBUNDLE) || defined(_WIN32) + struct stat statbuf; if (!err) { if (stat (filepath, &statbuf) < 0) { @@ -187,6 +202,7 @@ krb5int_open_plugin (const char *filepath, struct plugin_file_handle **h, struct filepath, strerror(err)); } } +#endif if (!err) { htmp = calloc (1, sizeof (*htmp)); /* calloc initializes ptrs to NULL */ @@ -194,11 +210,12 @@ krb5int_open_plugin (const char *filepath, struct plugin_file_handle **h, struct } #if USE_DLOPEN - if (!err && ((statbuf.st_mode & S_IFMT) == S_IFREG + if (!err #if USE_CFBUNDLE - || (statbuf.st_mode & S_IFMT) == S_IFDIR + && ((statbuf.st_mode & S_IFMT) == S_IFREG + || (statbuf.st_mode & S_IFMT) == S_IFDIR) #endif /* USE_CFBUNDLE */ - )) { + ) { void *handle = NULL; #if USE_CFBUNDLE