This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch, master, updated. glibc-2.14-315-g32c76b6
- From: schwab at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 27 Sep 2011 07:59:30 -0000
- Subject: GNU C Library master sources branch, master, updated. glibc-2.14-315-g32c76b6
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via 32c76b63be605d12314e0c6ac2bd702c883d1423 (commit)
from bf972c9dfcda9f95e337c6d4586abcc3bdf46561 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=32c76b63be605d12314e0c6ac2bd702c883d1423
commit 32c76b63be605d12314e0c6ac2bd702c883d1423
Author: Andreas Schwab <schwab@redhat.com>
Date: Mon Sep 26 17:49:14 2011 +0200
Correctly reparse group line after enlarging the buffer
diff --git a/ChangeLog b/ChangeLog
index 1047cce..716d805 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-09-27 Andreas Schwab <schwab@redhat.com>
+
+ * nss/nss_files/files-initgroups.c (_nss_files_initgroups_dyn):
+ Reread the line before reparsing it.
+
2011-09-26 Andreas Schwab <schwab@redhat.com>
* sysdeps/x86_64/fpu/bits/mathinline.h: Use __asm instead of asm.
diff --git a/nss/nss_files/files-initgroups.c b/nss/nss_files/files-initgroups.c
index 113abf2..c343b35 100644
--- a/nss/nss_files/files-initgroups.c
+++ b/nss/nss_files/files-initgroups.c
@@ -52,8 +52,10 @@ _nss_files_initgroups_dyn (const char *user, gid_t group, long int *start,
gid_t *groups = *groupsp;
/* We have to iterate over the entire file. */
- while (!feof_unlocked (stream))
+ while (1)
{
+ fpos_t pos;
+ fgetpos (stream, &pos);
ssize_t n = getline (&line, &linelen, stream);
if (n < 0)
{
@@ -64,9 +66,8 @@ _nss_files_initgroups_dyn (const char *user, gid_t group, long int *start,
}
struct group grp;
- int res;
- while ((res = _nss_files_parse_grent (line, &grp, buffer, buflen,
- errnop)) == -1)
+ int res = _nss_files_parse_grent (line, &grp, buffer, buflen, errnop);
+ if (res == -1)
{
size_t newbuflen = 2 * buflen;
if (buffer_use_malloc || ! __libc_use_alloca (buflen + newbuflen))
@@ -85,6 +86,9 @@ _nss_files_initgroups_dyn (const char *user, gid_t group, long int *start,
}
else
buffer = extend_alloca (buffer, buflen, newbuflen);
+ /* Reread current line, the parser has clobbered it. */
+ fsetpos (stream, &pos);
+ continue;
}
if (res > 0 && grp.gr_gid != group)
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 5 +++++
nss/nss_files/files-initgroups.c | 12 ++++++++----
2 files changed, 13 insertions(+), 4 deletions(-)
hooks/post-receive
--
GNU C Library master sources