Author: markj
Date: Tue Feb 14 21:51:19 2017
New Revision: 313748
URL: https://svnweb.freebsd.org/changeset/base/313748

Log:
  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

Modified:
  head/lib/libc/net/nsdispatch.c

Modified: head/lib/libc/net/nsdispatch.c
==============================================================================
--- head/lib/libc/net/nsdispatch.c      Tue Feb 14 21:36:18 2017        
(r313747)
+++ head/lib/libc/net/nsdispatch.c      Tue Feb 14 21:51:19 2017        
(r313748)
@@ -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
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to