diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2014-07-21 21:29:22 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2014-07-22 21:31:42 -0400 |
commit | fdadaf77ca45094e35ce724d7c91001f84b083c7 (patch) | |
tree | 8307bf236fb35fd0225e63e754ca71744cadef5a /mg.c | |
parent | 68419f9c61ef7c22b1225655e7e3b38058c70a71 (diff) | |
download | perl-fdadaf77ca45094e35ce724d7c91001f84b083c7.tar.gz |
Atol can be strtol in disguise, so grok_atou.
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -2891,6 +2891,7 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) { const char *p = SvPV_const(sv, len); Groups_t *gary = NULL; + const char* endptr; #ifdef _SC_NGROUPS_MAX int maxgrp = sysconf(_SC_NGROUPS_MAX); @@ -2902,19 +2903,20 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) while (isSPACE(*p)) ++p; - new_egid = (Gid_t)Atol(p); + new_egid = (Gid_t)grok_atou(p, &endptr); for (i = 0; i < maxgrp; ++i) { - while (*p && !isSPACE(*p)) - ++p; + if (endptr == NULL) + break; + p = endptr; while (isSPACE(*p)) ++p; if (!*p) break; - if(!gary) + if (!gary) Newx(gary, i + 1, Groups_t); else Renew(gary, i + 1, Groups_t); - gary[i] = (Groups_t)Atol(p); + gary[i] = (Groups_t)grok_atou(p, &endptr); } if (i) PERL_UNUSED_RESULT(setgroups(i, gary)); |