diff options
author | Hugo van der Sanden <hv@crypt.org> | 2015-02-23 16:48:15 +0000 |
---|---|---|
committer | Hugo van der Sanden <hv@crypt.org> | 2015-03-09 22:15:46 +0000 |
commit | 22ff313068aa37b1a24855e760e71ee9a20a1a90 (patch) | |
tree | 09da195258e4a85e42a39dd24d7c60c849409ef1 /mg.c | |
parent | 35cd12d12a5a5777098caf722f8748b39c3be45f (diff) | |
download | perl-22ff313068aa37b1a24855e760e71ee9a20a1a90.tar.gz |
[perl #123814] replace grok_atou with grok_atoUV
Some questions and loose ends:
XXX gv.c:S_gv_magicalize - why are we using SSize_t for paren?
XXX mg.c:Perl_magic_set - need appopriate error handling for $)
XXX regcomp.c:S_reg - need to check if we do the right thing if parno
was not grokked
Perl_get_debug_opts should probably return something unsigned; not sure
if that's something we can change.
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -3020,6 +3020,7 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) const char *p = SvPV_const(sv, len); Groups_t *gary = NULL; const char* endptr; + UV uv; #ifdef _SC_NGROUPS_MAX int maxgrp = sysconf(_SC_NGROUPS_MAX); @@ -3031,7 +3032,12 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) while (isSPACE(*p)) ++p; - new_egid = (Gid_t)grok_atou(p, &endptr); + if (grok_atoUV(p, &uv, &endptr)) + new_egid = (Gid_t)uv; + else { + new_egid = 0; /* XXX is this safe? */ + endptr = NULL; + } for (i = 0; i < maxgrp; ++i) { if (endptr == NULL) break; @@ -3044,7 +3050,12 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) Newx(gary, i + 1, Groups_t); else Renew(gary, i + 1, Groups_t); - gary[i] = (Groups_t)grok_atou(p, &endptr); + if (grok_atoUV(p, &uv, &endptr)) + gary[i] = (Groups_t)uv; + else { + gary[i] = 0; /* XXX is this safe? */ + endptr = NULL; + } } if (i) PERL_UNUSED_RESULT(setgroups(i, gary)); |