summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2003-11-06 22:01:03 +0000
committerManuel Novoa III <mjn3@codepoet.org>2003-11-06 22:01:03 +0000
commitd5465499fbc28031bc047f0cdcf13c1dde89b923 (patch)
treeeba628ec111a5037d248d4547d7e17cee69ed9e3
parent27c01b77f634be8c50e993cb497e08f4c0a754a8 (diff)
Sigh... I wasn't checking if the gid field in a group line actually
contained a digit. Also adjust a comment.
-rw-r--r--libc/pwd_grp/pwd_grp.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libc/pwd_grp/pwd_grp.c b/libc/pwd_grp/pwd_grp.c
index a48901428..74f784231 100644
--- a/libc/pwd_grp/pwd_grp.c
+++ b/libc/pwd_grp/pwd_grp.c
@@ -966,7 +966,11 @@ int __parsegrent(void *data, char *line)
/* NOTE: glibc difference - glibc allows omission of the
* trailing colon when there is no member list. We treat
* this as an error. */
- if (*endptr != ':') {
+
+ /* Make sure we had at least one digit, and that the
+ * failing char is the next field seperator ':'. See
+ * glibc difference note above. */
+ if ((endptr == line) || (*endptr != ':')) {
break;
}
@@ -1104,8 +1108,6 @@ int __parsespent(void *data, char * line)
* and for which the parser function succeeds.
*
* Returns 0 on success and ENOENT for end-of-file (glibc concession).
- * On error, it both sets errno to ERANGE and returns ERANGE.
- * (seems to be glibc behavior.)
*/
int __pgsreader(int (*__parserfunc)(void *d, char *line), void *data,