X-Git-Url: http://andersk.mit.edu/gitweb/nss_nonlocal.git/blobdiff_plain/dc397f8f1c8609311eeb93210e190ecffdda5cf4..4893970472bd815b8dbb6f6058dd26358700110e:/walk_nss.h diff --git a/walk_nss.h b/walk_nss.h index 93af177..78d3575 100644 --- a/walk_nss.h +++ b/walk_nss.h @@ -24,8 +24,9 @@ */ { - static service_user *startp = NULL; - static void *fct_start = NULL; + static bool initialized = false; + static service_user *startp; + static void *fct_start; service_user *nip; union { @@ -34,10 +35,13 @@ } fct; int old_errno = errno; - if (fct_start == NULL && - w.lookup(&startp, w.fct_name, &fct_start) != 0) { - *w.status = NSS_STATUS_UNAVAIL; - goto walk_nss_out; + if (!initialized) { + if (w.lookup(&startp, w.fct_name, &fct_start) != 0) { + *w.status = NSS_STATUS_UNAVAIL; + goto walk_nss_out; + } + __sync_synchronize(); + initialized = true; } nip = startp;