summaryrefslogtreecommitdiffstats
path: root/freebsd/lib/libc/net/nsdispatch.c
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/lib/libc/net/nsdispatch.c')
-rw-r--r--freebsd/lib/libc/net/nsdispatch.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/freebsd/lib/libc/net/nsdispatch.c b/freebsd/lib/libc/net/nsdispatch.c
index 1c7612f1..880a4101 100644
--- a/freebsd/lib/libc/net/nsdispatch.c
+++ b/freebsd/lib/libc/net/nsdispatch.c
@@ -351,6 +351,7 @@ static int
nss_configure(void)
{
static time_t confmod;
+ static int already_initialized = 0;
struct stat statbuf;
int result, isthreaded;
const char *path;
@@ -368,6 +369,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)