summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-09-25 05:55:20 +0000
committerUlrich Drepper <drepper@redhat.com>2004-09-25 05:55:20 +0000
commit9435d38cb1f0988a4f62fe30b90e29d9250054b1 (patch)
tree1f99edf1a3c1e900970739c768f005f75faadbd5
parent43ca813d87b81b1f713e4e48ed6fb760c235f14a (diff)
downloadglibc-9435d38cb1f0988a4f62fe30b90e29d9250054b1.tar.gz
glibc-9435d38cb1f0988a4f62fe30b90e29d9250054b1.tar.xz
glibc-9435d38cb1f0988a4f62fe30b90e29d9250054b1.zip
Update.
	* nis/ypclnt.c (do_ypcall): Add one missing unlock.  Simplify the
	code a bit.
-rw-r--r--ChangeLog3
-rw-r--r--nis/ypclnt.c16
2 files changed, 10 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index be347769f4..d717f84220 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2004-09-24  Ulrich Drepper  <drepper@redhat.com>
 
+	* nis/ypclnt.c (do_ypcall): Add one missing unlock.  Simplify the
+	code a bit.
+
 	* misc/daemon.c (daemon): Define errno in case /dev/null is not
 	the correct device.
 
diff --git a/nis/ypclnt.c b/nis/ypclnt.c
index 184e49de6d..f25c7c710b 100644
--- a/nis/ypclnt.c
+++ b/nis/ypclnt.c
@@ -304,16 +304,10 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs,
   status = YPERR_YPERR;
 
   __libc_lock_lock (ypbindlist_lock);
-  if (__ypbindlist != NULL)
+  ydb = __ypbindlist;
+  while (ydb != NULL)
     {
-      ydb = __ypbindlist;
-      while (ydb != NULL)
-        {
-          if (strcmp (domain, ydb->dom_domain) == 0)
-            break;
-          ydb = ydb->dom_pnext;
-        }
-      if (ydb != NULL)
+      if (strcmp (domain, ydb->dom_domain) == 0)
 	{
           if (__yp_bind (domain, &ydb) == 0)
 	    {
@@ -322,6 +316,7 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs,
 				      resp, &ydb, 0);
 	      if (status == YPERR_SUCCESS)
 	        {
+		  __libc_lock_unlock (ypbindlist_lock);
 	          __set_errno (saved_errno);
 	          return status;
 	        }
@@ -329,7 +324,10 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs,
 	  /* We use ypbindlist, and the old cached data is
 	     invalid. unbind now and create a new binding */
 	  yp_unbind_locked (domain);
+
+	  break;
 	}
+      ydb = ydb->dom_pnext;
     }
   __libc_lock_unlock (ypbindlist_lock);