diff options
author | Ulrich Drepper <drepper@redhat.com> | 2005-12-03 22:15:54 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2005-12-03 22:15:54 +0000 |
commit | 8e64faef03af02a8d4635d199a5b8e55ec68111e (patch) | |
tree | b9fc41a4185921aaf04c69fbf720a0fb410a4458 /nis/nss_nisplus/nisplus-pwd.c | |
parent | 636e689e6fb0da525b80620cdb64cdaf75aa3c6a (diff) | |
download | glibc-8e64faef03af02a8d4635d199a5b8e55ec68111e.tar.gz glibc-8e64faef03af02a8d4635d199a5b8e55ec68111e.tar.xz glibc-8e64faef03af02a8d4635d199a5b8e55ec68111e.zip |
* nis/nis_error.c (nis_sperror_r): Let snprintf determine whether
there is an overflow. * nis/nss_nisplus/nisplus-netgrp.c (_nss_nisplus_setnetgrent): Rewrite to use snprintf. * nis/nss_nisplus/nisplus-publickey.c (_nss_nisplus_netname2user): Likewise.
Diffstat (limited to 'nis/nss_nisplus/nisplus-pwd.c')
-rw-r--r-- | nis/nss_nisplus/nisplus-pwd.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/nis/nss_nisplus/nisplus-pwd.c b/nis/nss_nisplus/nisplus-pwd.c index a1c53f74a6..97679dd349 100644 --- a/nis/nss_nisplus/nisplus-pwd.c +++ b/nis/nss_nisplus/nisplus-pwd.c @@ -56,7 +56,12 @@ _nss_pwd_create_tablename (int *errnop) atomic_write_barrier (); - pwd_tablename_val = p; + if (atomic_compare_and_exchange_bool_acq (&pwd_tablename_val, p, NULL)) + { + /* Another thread already installed the value. */ + free (p); + pwd_tablename_len = strlen (pwd_tablename_val); + } } return NSS_STATUS_SUCCESS; @@ -181,12 +186,8 @@ _nss_nisplus_getpwnam_r (const char *name, struct passwd *pw, if (pwd_tablename_val == NULL) { - __libc_lock_lock (lock); - enum nss_status status = _nss_pwd_create_tablename (errnop); - __libc_lock_unlock (lock); - if (status != NSS_STATUS_SUCCESS) return status; } @@ -248,12 +249,8 @@ _nss_nisplus_getpwuid_r (const uid_t uid, struct passwd *pw, { if (pwd_tablename_val == NULL) { - __libc_lock_lock (lock); - enum nss_status status = _nss_pwd_create_tablename (errnop); - __libc_lock_unlock (lock); - if (status != NSS_STATUS_SUCCESS) return status; } |