diff options
author | markj <markj@FreeBSD.org> | 2017-03-10 18:56:23 +0000 |
---|---|---|
committer | markj <markj@FreeBSD.org> | 2017-03-10 18:56:23 +0000 |
commit | 28bfc8049ec4ce25d57ba8ad41f8cc5acecac559 (patch) | |
tree | 07cc6924e529c97b8bbc6429dd32758344f89494 /lib/libc | |
parent | 9a84a0784c84560cfaa7de28b50a582122416246 (diff) | |
download | FreeBSD-src-28bfc8049ec4ce25d57ba8ad41f8cc5acecac559.zip FreeBSD-src-28bfc8049ec4ce25d57ba8ad41f8cc5acecac559.tar.gz |
MFC r313748, r313749:
Register nss_atexit() before parsing nsswitch.conf for the first time.
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/net/nsdispatch.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/libc/net/nsdispatch.c b/lib/libc/net/nsdispatch.c index 4de1df3..d8bc2a7f 100644 --- a/lib/libc/net/nsdispatch.c +++ b/lib/libc/net/nsdispatch.c @@ -349,20 +349,20 @@ nss_configure(void) path = getenv("NSSWITCH_CONF"); if (path == NULL) #endif - path = _PATH_NS_CONF; + path = _PATH_NS_CONF; if (stat(path, &statbuf) != 0) return (0); if (statbuf.st_mtime <= confmod) return (0); if (isthreaded) { - (void)_pthread_rwlock_unlock(&nss_lock); - result = _pthread_rwlock_wrlock(&nss_lock); - if (result != 0) - return (result); - if (stat(path, &statbuf) != 0) - goto fin; - if (statbuf.st_mtime <= confmod) - goto fin; + (void)_pthread_rwlock_unlock(&nss_lock); + result = _pthread_rwlock_wrlock(&nss_lock); + if (result != 0) + return (result); + if (stat(path, &statbuf) != 0) + goto fin; + if (statbuf.st_mtime <= confmod) + goto fin; } _nsyyin = fopen(path, "re"); if (_nsyyin == NULL) @@ -371,27 +371,27 @@ 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 handle = libc_dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL); if (handle != NULL) { nss_cache_cycle_prevention_func = dlsym(handle, - "_nss_cache_cycle_prevention_function"); + "_nss_cache_cycle_prevention_function"); dlclose(handle); } #endif fin: if (isthreaded) { - (void)_pthread_rwlock_unlock(&nss_lock); - if (result == 0) - result = _pthread_rwlock_rdlock(&nss_lock); + (void)_pthread_rwlock_unlock(&nss_lock); + if (result == 0) + result = _pthread_rwlock_rdlock(&nss_lock); } return (result); } |