From 888e46a99b7440904a564a715e5aea0a7e74db0e Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Tue, 14 Feb 2017 21:51:19 +0000 Subject: [PATCH] Register nss_atexit() before parsing nsswitch.conf for the first time. NSS modules are loaded when nsswitch.conf is parsed and may register their own atexit handlers with libc. nss_atexit() unloads any dynamically loaded NSS modules, so it should run only after the modules' atexit handlers have been invoked. MFC after: 2 weeks Sponsored by: Dell EMC Isilon --- lib/libc/net/nsdispatch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/net/nsdispatch.c b/lib/libc/net/nsdispatch.c index 4de1df3ffd16..65a6877db36e 100644 --- a/lib/libc/net/nsdispatch.c +++ b/lib/libc/net/nsdispatch.c @@ -371,12 +371,12 @@ nss_configure(void) (vector_free_elem)ns_dbt_free); VECTOR_FREE(_nsmod, &_nsmodsize, sizeof(*_nsmod), (vector_free_elem)ns_mod_free); + if (confmod == 0) + (void)atexit(nss_atexit); nss_load_builtin_modules(); _nsyyparse(); (void)fclose(_nsyyin); vector_sort(_nsmap, _nsmapsize, sizeof(*_nsmap), string_compare); - if (confmod == 0) - (void)atexit(nss_atexit); confmod = statbuf.st_mtime; #ifdef NS_CACHING