* A new patch for nscd.
@ 1999-08-28 17:30 H.J. Lu
1999-08-30 12:07 ` Ulrich Drepper
0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 1999-08-28 17:30 UTC (permalink / raw)
To: GNU C Library
Here is the revised patch for nscd.
--
H.J. Lu (hjl@gnu.org)
---
Sat Aug 28 17:29:05 1999 H.J. Lu <hjl@gnu.org>
* nscd/nscd_getgr_r.c (nscd_getgr_r): Don't count the alloca'ed
memory for buffer.
Index: nscd/nscd_getgr_r.c
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/nscd/nscd_getgr_r.c,v
retrieving revision 1.1.1.14
diff -u -p -r1.1.1.14 nscd_getgr_r.c
--- nscd/nscd_getgr_r.c 1999/06/27 01:14:33 1.1.1.14
+++ nscd/nscd_getgr_r.c 1999/08/29 00:28:12
@@ -180,7 +180,7 @@ nscd_getgr_r (const char *key, size_t ke
vec[1].iov_len = gr_resp.gr_name_len + gr_resp.gr_passwd_len;
total_len += gr_resp.gr_name_len + gr_resp.gr_passwd_len;
- buflen -= total_len;
+ buflen -= gr_resp.gr_name_len + gr_resp.gr_passwd_len;
/* Get this data. */
if (__readv (sock, vec, 2) != total_len)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: A new patch for nscd.
1999-08-28 17:30 A new patch for nscd H.J. Lu
@ 1999-08-30 12:07 ` Ulrich Drepper
1999-08-31 15:25 ` H.J. Lu
0 siblings, 1 reply; 3+ messages in thread
From: Ulrich Drepper @ 1999-08-30 12:07 UTC (permalink / raw)
To: H.J. Lu; +Cc: GNU C Library
hjl@varesearch.com (H.J. Lu) writes:
> Here is the revised patch for nscd.
Yep, this is fine. Thanks,
--
---------------. drepper at gnu.org ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com `------------------------
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: A new patch for nscd.
1999-08-30 12:07 ` Ulrich Drepper
@ 1999-08-31 15:25 ` H.J. Lu
0 siblings, 0 replies; 3+ messages in thread
From: H.J. Lu @ 1999-08-31 15:25 UTC (permalink / raw)
To: drepper; +Cc: libc-hacker
>
> hjl@varesearch.com (H.J. Lu) writes:
>
> > Here is the revised patch for nscd.
>
> Yep, this is fine. Thanks,
>
The code is hard to read. This patch cleans it up a little bit and
makes it more readable.
--
H.J. Lu (hjl@gnu.org)
--
Tue Aug 31 15:19:12 1999 H.J. Lu <hjl@gnu.org>
* nscd/nscd_getgr_r.c (nscd_getgr_r): Cleanup the buffer count.
Index: nscd/nscd_getgr_r.c
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/nscd/nscd_getgr_r.c,v
retrieving revision 1.1.1.15
diff -u -p -r1.1.1.15 nscd_getgr_r.c
--- nscd/nscd_getgr_r.c 1999/08/31 17:28:53 1.1.1.15
+++ nscd/nscd_getgr_r.c 1999/08/31 22:18:14
@@ -147,19 +147,20 @@ nscd_getgr_r (const char *key, size_t ke
align the pointer. */
align = ((__alignof__ (char *) - (p - ((char *) 0)))
& (__alignof__ (char *) - 1));
- if (buflen < (align + (1 + gr_resp.gr_mem_cnt) * sizeof (char *)
- + gr_resp.gr_name_len + gr_resp.gr_passwd_len))
+ total_len = align + (1 + gr_resp.gr_mem_cnt) * sizeof (char *)
+ + gr_resp.gr_name_len + gr_resp.gr_passwd_len;
+ if (buflen < total_len)
{
no_room:
__set_errno (ERANGE);
__close (sock);
return ERANGE;
}
+ buflen -= total_len;
p += align;
resultbuf->gr_mem = (char **) p;
p += (1 + gr_resp.gr_mem_cnt) * sizeof (char *);
- buflen -= align + (1 + gr_resp.gr_mem_cnt) * sizeof (char *);
/* Set pointers for strings. */
resultbuf->gr_name = p;
@@ -179,8 +180,6 @@ nscd_getgr_r (const char *key, size_t ke
vec[1].iov_base = resultbuf->gr_name;
vec[1].iov_len = gr_resp.gr_name_len + gr_resp.gr_passwd_len;
total_len += gr_resp.gr_name_len + gr_resp.gr_passwd_len;
-
- buflen -= gr_resp.gr_name_len + gr_resp.gr_passwd_len;
/* Get this data. */
if (__readv (sock, vec, 2) != total_len)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1999-08-31 15:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-08-28 17:30 A new patch for nscd H.J. Lu
1999-08-30 12:07 ` Ulrich Drepper
1999-08-31 15:25 ` H.J. Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).