summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-05-20 01:04:08 +0000
committerUlrich Drepper <drepper@redhat.com>2006-05-20 01:04:08 +0000
commit1d4f062ab84f24cab893a9211e3e72b2f1f470ce (patch)
tree7b49b965d46d0dacc6eb86ab54cc582a8db79389
parent101cc59887f30651022b57f00200e5528990d190 (diff)
downloadglibc-1d4f062ab84f24cab893a9211e3e72b2f1f470ce.tar.gz
glibc-1d4f062ab84f24cab893a9211e3e72b2f1f470ce.tar.xz
glibc-1d4f062ab84f24cab893a9211e3e72b2f1f470ce.zip
* nis/nis_call.c (__do_niscall3): Avoid code duplication in error
	handling.
-rw-r--r--ChangeLog3
-rw-r--r--nis/nis_call.c31
2 files changed, 7 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index a995578297..5ae1fea159 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2006-05-19  Ulrich Drepper  <drepper@redhat.com>
 
+	* nis/nis_call.c (__do_niscall3): Avoid code duplication in error
+	handling.
+
 	* nis/nis_callback.c (internal_nis_do_callback): Don't use malloc
 	to allocate memory for my_pollfd.  Better initialization of
 	cb_is_running.  Use TEMP_FAILURE_RETRY.
diff --git a/nis/nis_call.c b/nis/nis_call.c
index 753ef77997..499d042e3c 100644
--- a/nis/nis_call.c
+++ b/nis/nis_call.c
@@ -256,6 +256,7 @@ __do_niscall3 (dir_binding *dbp, u_long prog, xdrproc_t xargs, caddr_t req,
 		  || ((nis_result *)resp)->status == NIS_NOSUCHNAME
 		  || ((nis_result *)resp)->status == NIS_NOT_ME)
 		{
+		next_server:
 		  if (__nisbind_next (dbp) == NIS_SUCCESS)
 		    {
 		      while (__nisbind_connect (dbp) != NIS_SUCCESS)
@@ -273,38 +274,14 @@ __do_niscall3 (dir_binding *dbp, u_long prog, xdrproc_t xargs, caddr_t req,
 	      if (((fd_result *)resp)->status == NIS_SYSTEMERROR
 		  || ((fd_result *)resp)->status == NIS_NOSUCHNAME
 		  || ((fd_result *)resp)->status == NIS_NOT_ME)
-		{
-		  if (__nisbind_next (dbp) == NIS_SUCCESS)
-		    {
-		      while (__nisbind_connect (dbp) != NIS_SUCCESS)
-			{
-			  if (__nisbind_next (dbp) != NIS_SUCCESS)
-			    return NIS_SUCCESS;
-			}
-		    }
-		  else
-		    break; /* No more servers to search in */
-		  goto again;
-		}
+		goto next_server;
 	      break;
 	    case NIS_DUMPLOG: /* log_result */
 	    case NIS_DUMP:
 	      if (((log_result *)resp)->lr_status == NIS_SYSTEMERROR
 		  || ((log_result *)resp)->lr_status == NIS_NOSUCHNAME
 		  || ((log_result *)resp)->lr_status == NIS_NOT_ME)
-		{
-		  if (__nisbind_next (dbp) == NIS_SUCCESS)
-		    {
-		      while (__nisbind_connect (dbp) != NIS_SUCCESS)
-			{
-			  if (__nisbind_next (dbp) != NIS_SUCCESS)
-			    return NIS_SUCCESS;
-			}
-		    }
-		  else
-		    break; /* No more servers to search in */
-		  goto again;
-		}
+		goto next_server;
 	      break;
 	    default:
 	      break;
@@ -425,7 +402,7 @@ rec_dirsearch (const_nis_name name, directory_obj *dir, nis_error *status)
 	    ++run;
 	  }
 	while (nis_dir_cmp (domain, dir->do_name) != SAME_NAME);
-
+	printf("%s: run=%u\n", __func__, run);
 	if (run == 1)
 	  {
 	    /* We have found the directory above. Use it. */