* nis/nis_call.c (do_ypcall, yp_all): Safe and reset errno.
This commit is contained in:
Ulrich Drepper 1998-03-06 09:18:45 +00:00
parent 36a8586ddf
commit a788b6c216
4 changed files with 38 additions and 16 deletions

View File

@ -1,6 +1,6 @@
1998-03-06 Andreas Jaeger <aj@arthur.rhein-neckar.de> 1998-03-06 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* nis/nis_call.c (__do_niscall): Safe and reset errno. * nis/nis_call.c (do_ypcall, yp_all): Safe and reset errno.
* nis/ypclnt.c (__yp_bind): Safe and reset errno. * nis/ypclnt.c (__yp_bind): Safe and reset errno.

19
FAQ.in
View File

@ -550,7 +550,16 @@ http://www-vt.uni-paderborn.de/~kukuk/linux/nisplus.html).
from ypbind. ypbind 3.3 and older versions don't always remove these from ypbind. ypbind 3.3 and older versions don't always remove these
files, so glibc will continue to use them. Other BSD versions seem to files, so glibc will continue to use them. Other BSD versions seem to
work correctly. Until ypbind 3.4 is released, you can find a patch at work correctly. Until ypbind 3.4 is released, you can find a patch at
ftp://ftp.kernel.org/pub/linux/utils/net/NIS/ypbind-3.3-glibc2.diff. ftp://ftp.kernel.org/pub/linux/utils/net/NIS/ypbind-3.3-glibc3.diff.
?? Under Linux/Alpha, I always get "do_ypcall: clnt_call:
RPC: Unable to receive; errno = Connection refused" when using NIS.
{TK} You need a ypbind version which is 64bit clean. Some versions
are not 64bit clean. A 64bit clean implemention is ypbind-mt. For
ypbind 3.3, you need the patch from ftp.kernel.org (See the previous
question). I don't know about other versions.
?? After installing glibc name resolving doesn't work properly. ?? After installing glibc name resolving doesn't work properly.
@ -611,11 +620,11 @@ problem.
?? What do I need for C++ development? ?? What do I need for C++ development?
{HJ,AJ} You need either egcs 1.0.1 or gcc-2.8.0 with libstdc++ {HJ,AJ} You need either egcs 1.0.1 or gcc-2.8.1 with libstdc++
2.8.0. libg++ 2.7.2 (and the Linux Versions 2.7.2.x) doesn't work very 2.8.1 (or more recent versions). libg++ 2.7.2 (and the Linux Versions
well with the GNU C library due to vtable thunks. 2.7.2.x) doesn't work very well with the GNU C library due to vtable thunks.
If you're upgrading from glibc 2.0.x to 2.1 you have to recompile If you're upgrading from glibc 2.0.x to 2.1 you have to recompile
libstc++ the library compiled for 2.0 is not compatible due to the new libstc++ since the library compiled for 2.0 is not compatible due to the new
Large File Support (LFS) in version 2.1. Large File Support (LFS) in version 2.1.
? Source and binary incompatibilities, and what to do about them ? Source and binary incompatibilities, and what to do about them

View File

@ -581,7 +581,10 @@ __do_niscall (const_nis_name name, u_long prog, xdrproc_t xargs,
dir = rec_dirsearch (name, dir, flags, &status); dir = rec_dirsearch (name, dir, flags, &status);
if (dir == NULL) if (dir == NULL)
return status; {
__set_errno (saved_errno);
return status;
}
} }
if (flags & MASTER_ONLY) if (flags & MASTER_ONLY)
@ -601,5 +604,7 @@ __do_niscall (const_nis_name name, u_long prog, xdrproc_t xargs,
nis_free_directory (dir); nis_free_directory (dir);
__set_errno (saved_errno);
return retcode; return retcode;
} }

View File

@ -104,7 +104,6 @@ __yp_bind (const char *domain, dom_binding **ypdb)
struct iovec vec[2]; struct iovec vec[2];
u_short port; u_short port;
int fd; int fd;
int saved_errno = errno;
sprintf (path, "%s/%s.%ld", BINDINGDIR, domain, YPBINDVERS); sprintf (path, "%s/%s.%ld", BINDINGDIR, domain, YPBINDVERS);
fd = open (path, O_RDONLY); fd = open (path, O_RDONLY);
@ -133,14 +132,11 @@ __yp_bind (const char *domain, dom_binding **ypdb)
} }
close (fd); close (fd);
} }
__set_errno (saved_errno);
} }
#endif /* USE_BINDINGDIR */ #endif /* USE_BINDINGDIR */
if (ysd->dom_vers == -1) if (ysd->dom_vers == -1)
{ {
int saved_errno = errno;
if(ysd->dom_client) if(ysd->dom_client)
{ {
clnt_destroy(ysd->dom_client); clnt_destroy(ysd->dom_client);
@ -157,7 +153,6 @@ __yp_bind (const char *domain, dom_binding **ypdb)
{ {
if (is_new) if (is_new)
free (ysd); free (ysd);
__set_errno (saved_errno);
return YPERR_YPBIND; return YPERR_YPBIND;
} }
/* /*
@ -170,7 +165,6 @@ __yp_bind (const char *domain, dom_binding **ypdb)
clnt_destroy (client); clnt_destroy (client);
if (is_new) if (is_new)
free (ysd); free (ysd);
__set_errno (saved_errno);
return YPERR_YPBIND; return YPERR_YPBIND;
} }
@ -253,6 +247,7 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs,
bool_t use_ypbindlist = FALSE; bool_t use_ypbindlist = FALSE;
int try, status; int try, status;
enum clnt_stat result; enum clnt_stat result;
int saved_errno = errno;
try = 0; try = 0;
status = YPERR_YPERR; status = YPERR_YPERR;
@ -281,6 +276,7 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs,
{ {
if (use_ypbindlist) if (use_ypbindlist)
__libc_lock_unlock (ypbindlist_lock); __libc_lock_unlock (ypbindlist_lock);
__set_errno (saved_errno);
return YPERR_DOMAIN; return YPERR_DOMAIN;
} }
@ -317,6 +313,8 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs,
ydb = NULL; ydb = NULL;
} }
__set_errno (saved_errno);
return status; return status;
} }
@ -670,6 +668,7 @@ yp_all (const char *indomain, const char *inmap,
CLIENT *clnt; CLIENT *clnt;
unsigned long status; unsigned long status;
int clnt_sock; int clnt_sock;
int saved_errno = errno;
if (indomain == NULL || indomain[0] == '\0' || if (indomain == NULL || indomain[0] == '\0' ||
inmap == NULL || inmap == '\0') inmap == NULL || inmap == '\0')
@ -682,6 +681,7 @@ yp_all (const char *indomain, const char *inmap,
{ {
if (__yp_bind (indomain, &ydb) != 0) if (__yp_bind (indomain, &ydb) != 0)
{ {
__set_errno (saved_errno);
return YPERR_DOMAIN; return YPERR_DOMAIN;
} }
@ -691,7 +691,10 @@ yp_all (const char *indomain, const char *inmap,
clnt_sin.sin_port = 0; clnt_sin.sin_port = 0;
clnt = clnttcp_create (&clnt_sin, YPPROG, YPVERS, &clnt_sock, 0, 0); clnt = clnttcp_create (&clnt_sin, YPPROG, YPVERS, &clnt_sock, 0, 0);
if (clnt == NULL) if (clnt == NULL)
return YPERR_PMAP; {
__set_errno (saved_errno);
return YPERR_PMAP;
}
req.domain = (char *) indomain; req.domain = (char *) indomain;
req.map = (char *) inmap; req.map = (char *) inmap;
@ -714,10 +717,15 @@ yp_all (const char *indomain, const char *inmap,
close (clnt_sock); close (clnt_sock);
if (status != YP_NOMORE) if (status != YP_NOMORE)
return ypprot_err (status); {
try++; __set_errno (saved_errno);
return ypprot_err (status);
}
++try;
} }
__set_errno (saved_errno);
return res; return res;
} }