diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2018-11-12 16:41:41 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2018-11-12 16:41:41 +0000 |
commit | 9b5cb2f639cc6e119a8433e2db6858e4ccab24b4 (patch) | |
tree | 5ca0f0db6479a7035932c908442c432add45b234 /lib/libc/net/nsdispatch.c | |
parent | 8c1538224adf39b7486c5f4d0c0f18317f60f157 (diff) | |
parent | 389474c122a3863189f5cebefd0620723ae143dc (diff) |
Notes
Diffstat (limited to 'lib/libc/net/nsdispatch.c')
-rw-r--r-- | lib/libc/net/nsdispatch.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/libc/net/nsdispatch.c b/lib/libc/net/nsdispatch.c index b9533bd1ca46d..b0f80d079b0b3 100644 --- a/lib/libc/net/nsdispatch.c +++ b/lib/libc/net/nsdispatch.c @@ -335,6 +335,7 @@ static int nss_configure(void) { static time_t confmod; + static int already_initialized = 0; struct stat statbuf; int result, isthreaded; const char *path; @@ -352,6 +353,16 @@ nss_configure(void) if (path == NULL) #endif path = _PATH_NS_CONF; +#ifndef NS_REREAD_CONF + /* + * Define NS_REREAD_CONF to have nsswitch notice changes + * to nsswitch.conf(5) during runtime. This involves calling + * stat(2) every time, which can result in performance hit. + */ + if (already_initialized) + return (0); + already_initialized = 1; +#endif /* NS_REREAD_CONF */ if (stat(path, &statbuf) != 0) return (0); if (statbuf.st_mtime <= confmod) |