X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fpasswd%2Fgetgrent_a.c;h=2cb8521532f8171f366b037d967f71f42eb7f9af;hp=780560ddb7a0f91c763797d0b73586fd09797c5b;hb=648c3b4e18b2ce2b6af7d44783e42ca267ea49f5;hpb=df065781ee913681ba86a636a2516cb0162cab19 diff --git a/src/passwd/getgrent_a.c b/src/passwd/getgrent_a.c index 780560dd..2cb85215 100644 --- a/src/passwd/getgrent_a.c +++ b/src/passwd/getgrent_a.c @@ -1,6 +1,13 @@ #include "pwf.h" #include +static unsigned atou(char **s) +{ + unsigned x; + for (x=0; **s-'0'<10U; ++*s) x=10*x+(**s-'0'); + return x; +} + struct group *__getgrent_a(FILE *f, struct group *gr, char **line, size_t *size, char ***mem, size_t *nmem) { ssize_t l; @@ -24,8 +31,8 @@ struct group *__getgrent_a(FILE *f, struct group *gr, char **line, size_t *size, *s++ = 0; gr->gr_passwd = s; if (!(s = strchr(s, ':'))) continue; - *s++ = 0; gr->gr_gid = atoi(s); - if (!(s = strchr(s, ':'))) continue; + *s++ = 0; gr->gr_gid = atou(&s); + if (*s != ':') continue; *s++ = 0; mems = s; break;