summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorBrian Fraser <fraserbn@gmail.com>2013-05-23 00:44:15 -0300
committerTony Cook <tony@develop-help.com>2013-06-04 18:45:38 +1000
commitdfff4baff950c3688d6f16335fa1e1037bb84bd0 (patch)
tree93d04ea7777f2ff99152da88b12a87004fdb8671 /pp_hot.c
parentbcbe2b27bd9868685fb7b4a6158b08674d0387cd (diff)
downloadperl-dfff4baff950c3688d6f16335fa1e1037bb84bd0.tar.gz
Stop making assumptions about uids and gids.
The code dealt rather inconsistently with uids and gids. Some places assumed that they could be safely stored in UVs, others in IVs, others in ints; All of them should've been using the macros from config.h instead. Similarly, code that created SVs or pushed values into the stack was also making incorrect assumptions -- As a point of reference, only pp_stat did the right thing: #if Uid_t_size > IVSIZE mPUSHn(PL_statcache.st_uid); #else # if Uid_t_sign <= 0 mPUSHi(PL_statcache.st_uid); # else mPUSHu(PL_statcache.st_uid); # endif #endif The other places were potential bugs, and some were even causing warnings in some unusual OSs, like haiku or qnx. This commit ammends the situation by introducing four new macros, SvUID(), sv_setuid(), SvGID(), and sv_setgid(), and using them where needed.
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 26c608a168..96c93a85d5 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1173,10 +1173,10 @@ PP(pp_aassign)
}
if (PL_delaymagic & ~DM_DELAY) {
/* Will be used to set PL_tainting below */
- UV tmp_uid = PerlProc_getuid();
- UV tmp_euid = PerlProc_geteuid();
- UV tmp_gid = PerlProc_getgid();
- UV tmp_egid = PerlProc_getegid();
+ Uid_t tmp_uid = PerlProc_getuid();
+ Uid_t tmp_euid = PerlProc_geteuid();
+ Gid_t tmp_gid = PerlProc_getgid();
+ Gid_t tmp_egid = PerlProc_getegid();
if (PL_delaymagic & DM_UID) {
#ifdef HAS_SETRESUID