aboutsummaryrefslogtreecommitdiff
path: root/nscd/nscd_getgr_r.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-01-15 10:52:50 +0000
committerUlrich Drepper <drepper@redhat.com>2003-01-15 10:52:50 +0000
commit9caf4f1c67e137804f4bca9eb65bd0132424022a (patch)
tree33f1aa53ffc08e5aff06a6c7eb6977969febeb51 /nscd/nscd_getgr_r.c
parentc9f24336e0c78fc4722f857902f1bf921b2ca1d1 (diff)
downloadglibc-9caf4f1c67e137804f4bca9eb65bd0132424022a.tar
glibc-9caf4f1c67e137804f4bca9eb65bd0132424022a.tar.gz
glibc-9caf4f1c67e137804f4bca9eb65bd0132424022a.tar.bz2
glibc-9caf4f1c67e137804f4bca9eb65bd0132424022a.zip
Update.
* nscd/nscd_getpw_r.c (nscd_getpw_r): Consolidate writing of the request with one writev call. Protect all read calls with TEMP_FAILURE_RETRY. * nscd/nscd_getgr_r.c (nscd_getgr_r): Likewise. * nscd/nscd_gethst_r.c (nscd_gethst_r): Likewise. * nscd/hstcache.c: Use extend_alloca to reallocate alloca'd buffer. Protect writev calls with TEMP_FAILURE_RETRY. * nscd/grpcache.c: Likewise. * nscd/pwdcache.c: Likewise.
Diffstat (limited to 'nscd/nscd_getgr_r.c')
-rw-r--r--nscd/nscd_getgr_r.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/nscd/nscd_getgr_r.c b/nscd/nscd_getgr_r.c
index ab9eef4e24..49f4b51304 100644
--- a/nscd/nscd_getgr_r.c
+++ b/nscd/nscd_getgr_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1998.
@@ -114,13 +114,15 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
vec[1].iov_base = (void *) key;
vec[1].iov_len = keylen;
- if ((size_t) __writev (sock, vec, 2) != sizeof (request_header) + keylen)
+ nbytes = (size_t) TEMP_FAILURE_RETRY (__writev (sock, vec, 2));
+ if (nbytes != sizeof (request_header) + keylen)
{
__close (sock);
return -1;
}
- nbytes = __read (sock, &gr_resp, sizeof (gr_response_header));
+ nbytes = TEMP_FAILURE_RETRY (__read (sock, &gr_resp,
+ sizeof (gr_response_header)));
if (nbytes != sizeof (gr_response_header))
{
__close (sock);
@@ -182,7 +184,7 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
total_len += gr_resp.gr_name_len + gr_resp.gr_passwd_len;
/* Get this data. */
- if ((size_t) __readv (sock, vec, 2) != total_len)
+ if ((size_t) TEMP_FAILURE_RETRY (__readv (sock, vec, 2)) != total_len)
{
__close (sock);
return -1;
@@ -203,7 +205,8 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
if (total_len > buflen)
goto no_room;
- if (__read (sock, resultbuf->gr_mem[0], total_len) != total_len)
+ if ((size_t) TEMP_FAILURE_RETRY (__read (sock, resultbuf->gr_mem[0],
+ total_len)) != total_len)
{
__close (sock);
/* The `errno' to some value != ERANGE. */