dTARGET;
Mode_t anum;
- if (MAXARG < 1) {
+ if (MAXARG < 1 || (!TOPs && !POPs)) {
anum = PerlLIO_umask(022);
/* setting it to 022 between the two calls to umask avoids
* to have a window where the umask is set to 0 -- meaning
/* Only DIE if trying to restrict permissions on "user" (self).
* Otherwise it's harmless and more useful to just return undef
* since 'group' and 'other' concepts probably don't exist here. */
- if (MAXARG >= 1 && (POPi & 0700))
+ if (MAXARG >= 1 && (TOPs||POPs) && (POPi & 0700))
DIE(aTHX_ "umask not implemented");
XPUSHs(&PL_sv_undef);
#endif
{
dVAR;
dSP;
- const int perm = (MAXARG > 3) ? POPi : 0666;
+ const int perm = (MAXARG > 3 && (TOPs || POPs)) ? POPi : 0666;
const int mode = POPi;
SV * const sv = POPs;
GV * const gv = MUTABLE_GV(POPs);
GV *gv;
IO *io;
- if (MAXARG != 0)
+ if (MAXARG != 0 && (TOPs || POPs))
PL_last_in_gv = MUTABLE_GV(POPs);
else
EXTEND(SP, 1);
STRLEN len;
const char *tmps;
bool copy = FALSE;
- const int mode = (MAXARG > 1) ? POPi : 0777;
+ const int mode = (MAXARG > 1 && (TOPs||((void)POPs,0))) ? POPi : 0777;
TRIMSLASHES(tmps,len,copy);
dVAR; dSP; dTARGET;
Pid_t pgrp;
Pid_t pid;
- if (MAXARG < 2) {
- pgrp = 0;
+ pgrp = MAXARG == 2 && (TOPs||POPs) ? POPi : 0;
+ if (MAXARG > 0) pid = TOPs && TOPi;
+ else {
pid = 0;
XPUSHi(-1);
}
- else {
- pgrp = POPi;
- pid = TOPi;
- }
TAINT_PROPER("setpgrp");
#ifdef BSD_SETPGRP
{"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
- if (MAXARG < 1) {
+ if (MAXARG < 1 || (!TOPs && ((void)POPs, 1))) {
time_t now;
(void)time(&now);
when = (Time64_T)now;
Time_t when;
(void)time(&lasttime);
- if (MAXARG < 1)
+ if (MAXARG < 1 || (!TOPs && !POPs))
PerlProc_pause();
else {
duration = POPi;