Fix bug [perl #24641] : when POSIX::set[ug]id() are called,
Rafael Garcia-Suarez [Thu, 25 Dec 2003 21:22:25 +0000 (21:22 +0000)]
update the perl variables PL_uid and PL_euid (resp. PL_gid
and PL_egid) with the new values.

p4raw-id: //depot/perl@21958

ext/POSIX/POSIX.xs

index 049c1b6..3b39038 100644 (file)
@@ -1827,10 +1827,20 @@ pause()
 SysRet
 setgid(gid)
        Gid_t           gid
+    CLEANUP:
+       if (RETVAL >= 0) {
+           PL_gid  = getgid();
+           PL_egid = getegid();
+       }
 
 SysRet
 setuid(uid)
        Uid_t           uid
+    CLEANUP:
+       if (RETVAL >= 0) {
+           PL_uid  = getuid();
+           PL_euid = geteuid();
+       }
 
 SysRetLong
 sysconf(name)