about summary refs log tree commit diff
path: root/nis
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-03-06 08:52:47 +0000
committerUlrich Drepper <drepper@redhat.com>1998-03-06 08:52:47 +0000
commit36a8586ddfca3b825704eedda81c81ac8d653f1e (patch)
treec840d4ae7316819472c112325c62b06ed226f726 /nis
parentb3c06869ccbf976b78a93a526d82023a2e596cb8 (diff)
downloadglibc-36a8586ddfca3b825704eedda81c81ac8d653f1e.tar.gz
glibc-36a8586ddfca3b825704eedda81c81ac8d653f1e.tar.xz
glibc-36a8586ddfca3b825704eedda81c81ac8d653f1e.zip
Update.
1998-03-06  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* nis/nis_call.c (__do_niscall): Safe and reset errno.

	* nis/ypclnt.c (__yp_bind): Safe and reset errno.
Diffstat (limited to 'nis')
-rw-r--r--nis/nis_call.c7
-rw-r--r--nis/ypclnt.c20
2 files changed, 19 insertions, 8 deletions
diff --git a/nis/nis_call.c b/nis/nis_call.c
index 196f6b36f1..8e0aca20ce 100644
--- a/nis/nis_call.c
+++ b/nis/nis_call.c
@@ -17,6 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <errno.h>
 #include <fcntl.h>
 #include <string.h>
 #include <rpc/rpc.h>
@@ -559,6 +560,7 @@ __do_niscall (const_nis_name name, u_long prog, xdrproc_t xargs,
   nis_server *server;
   u_int server_len;
   cache2_info cinfo = {-1, -1, -1};
+  int saved_errno = errno;
 
   if (name == NULL)
     return NIS_BADNAME;
@@ -572,7 +574,10 @@ __do_niscall (const_nis_name name, u_long prog, xdrproc_t xargs,
       nis_error status;
       dir = readColdStartFile ();
       if (dir == NULL) /* No /var/nis/NIS_COLD_START->no NIS+ installed */
-	return NIS_UNAVAIL;
+	{
+	  __set_errno (saved_errno);
+	  return NIS_UNAVAIL;
+	}
 
       dir = rec_dirsearch (name, dir, flags, &status);
       if (dir == NULL)
diff --git a/nis/ypclnt.c b/nis/ypclnt.c
index 9b936457a5..924a6293f1 100644
--- a/nis/ypclnt.c
+++ b/nis/ypclnt.c
@@ -104,6 +104,7 @@ __yp_bind (const char *domain, dom_binding **ypdb)
 	  struct iovec vec[2];
 	  u_short port;
 	  int fd;
+	  int saved_errno = errno;
 
 	  sprintf (path, "%s/%s.%ld", BINDINGDIR, domain, YPBINDVERS);
 	  fd = open (path, O_RDONLY);
@@ -132,17 +133,20 @@ __yp_bind (const char *domain, dom_binding **ypdb)
 		}
 	      close (fd);
 	    }
+	  __set_errno (saved_errno);
 	}
 #endif /* USE_BINDINGDIR */
 
       if (ysd->dom_vers == -1)
-        {
-          if(ysd->dom_client)
-            {
-              clnt_destroy(ysd->dom_client);
-              ysd->dom_client = NULL;
-              ysd->dom_socket = -1;
-            }
+	{
+	  int saved_errno = errno;
+
+	  if(ysd->dom_client)
+	    {
+	      clnt_destroy(ysd->dom_client);
+	      ysd->dom_client = NULL;
+	      ysd->dom_socket = -1;
+	    }
           memset (&clnt_saddr, '\0', sizeof clnt_saddr);
           clnt_saddr.sin_family = AF_INET;
           clnt_saddr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
@@ -153,6 +157,7 @@ __yp_bind (const char *domain, dom_binding **ypdb)
             {
               if (is_new)
                 free (ysd);
+	      __set_errno (saved_errno);
               return YPERR_YPBIND;
             }
           /*
@@ -165,6 +170,7 @@ __yp_bind (const char *domain, dom_binding **ypdb)
               clnt_destroy (client);
               if (is_new)
                 free (ysd);
+	      __set_errno (saved_errno);
               return YPERR_YPBIND;
             }