PP(pp_glob)
{
OP *result;
+ tryAMAGICunTARGET(iter, -1);
+
ENTER;
#ifndef VMS
* so for security reasons we must assume the worst.
*/
TAINT;
- taint_proper(no_security, "glob");
+ taint_proper(PL_no_security, "glob");
}
#endif /* !VMS */
if (MAXARG > 1)
sv = POPs;
if (!isGV(TOPs))
- DIE(no_usym, "filehandle");
+ DIE(PL_no_usym, "filehandle");
if (MAXARG <= 1)
sv = GvSV(TOPs);
gv = (GV*)POPs;
if (!isGV(gv))
- DIE(no_usym, "filehandle");
+ DIE(PL_no_usym, "filehandle");
if (GvIOp(gv))
IoFLAGS(GvIOp(gv)) &= ~IOf_UNTAINT;
tmps = SvPV(sv, len);
goto badexit;
if (SvTYPE(rgv) != SVt_PVGV || SvTYPE(wgv) != SVt_PVGV)
- DIE(no_usym, "filehandle");
+ DIE(PL_no_usym, "filehandle");
rstio = GvIOn(rgv);
wstio = GvIOn(wgv);
else PerlLIO_close(fd[1]);
goto badexit;
}
-
+#if defined(HAS_FCNTL) && defined(F_SETFD)
+ fcntl(fd[0],F_SETFD,fd[0] > PL_maxsysfd); /* ensure close-on-exec */
+ fcntl(fd[1],F_SETFD,fd[1] > PL_maxsysfd); /* ensure close-on-exec */
+#endif
RETPUSHYES;
badexit:
RETPUSHUNDEF;
#else
- DIE(no_func, "pipe");
+ DIE(PL_no_func, "pipe");
#endif
}
}
#else
if (PL_op->op_type == OP_RECV)
- DIE(no_sock_func, "recv");
+ DIE(PL_no_sock_func, "recv");
#endif
if (offset < 0) {
if (-offset > blen)
Zero(buffer+bufsize, offset-bufsize, char);
}
if (PL_op->op_type == OP_SYSREAD) {
- length = PerlLIO_read(PerlIO_fileno(IoIFP(io)), buffer+offset, length);
+#ifdef PERL_SOCK_SYSREAD_IS_RECV
+ if (IoTYPE(io) == 's') {
+ length = PerlSock_recv(PerlIO_fileno(IoIFP(io)),
+ buffer+offset, length, 0);
+ }
+ else
+#endif
+ {
+ length = PerlLIO_read(PerlIO_fileno(IoIFP(io)),
+ buffer+offset, length);
+ }
}
else
#ifdef HAS_SOCKET__bad_code_maybe
djSP;
int items = (SP - PL_stack_base) - TOPMARK;
if (items == 2) {
+ SV *sv;
EXTEND(SP, 1);
- PUSHs(sv_2mortal(newSViv(sv_len(*SP))));
+ sv = sv_2mortal(newSViv(sv_len(*SP)));
+ PUSHs(sv);
PUTBACK;
}
return pp_send(ARGS);
offset = 0;
if (length > blen - offset)
length = blen - offset;
- length = PerlLIO_write(PerlIO_fileno(IoIFP(io)), buffer+offset, length);
+#ifdef PERL_SOCK_SYSWRITE_IS_SEND
+ if (IoTYPE(io) == 's') {
+ length = PerlSock_send(PerlIO_fileno(IoIFP(io)),
+ buffer+offset, length, 0);
+ }
+ else
+#endif
+ {
+ length = PerlLIO_write(PerlIO_fileno(IoIFP(io)),
+ buffer+offset, length);
+ }
}
#ifdef HAS_SOCKET
else if (SP > MARK) {
#else
else
- DIE(no_sock_func, "send");
+ DIE(PL_no_sock_func, "send");
#endif
if (length < 0)
goto say_undef;
if (SvPOK(argsv)) {
if (s[SvCUR(argsv)] != 17)
DIE("Possible memory corruption: %s overflowed 3rd argument",
- op_name[optype]);
+ PL_op_name[optype]);
s[SvCUR(argsv)] = 0; /* put our null back */
SvSETMAGIC(argsv); /* Assume it has changed */
}
PUSHi(value);
RETURN;
#else
- DIE(no_func, "flock()");
+ DIE(PL_no_func, "flock()");
#endif
}
RETPUSHYES;
#else
- DIE(no_sock_func, "socket");
+ DIE(PL_no_sock_func, "socket");
#endif
}
RETPUSHYES;
#else
- DIE(no_sock_func, "socketpair");
+ DIE(PL_no_sock_func, "socketpair");
#endif
}
SETERRNO(EBADF,SS$_IVCHAN);
RETPUSHUNDEF;
#else
- DIE(no_sock_func, "bind");
+ DIE(PL_no_sock_func, "bind");
#endif
}
SETERRNO(EBADF,SS$_IVCHAN);
RETPUSHUNDEF;
#else
- DIE(no_sock_func, "connect");
+ DIE(PL_no_sock_func, "connect");
#endif
}
SETERRNO(EBADF,SS$_IVCHAN);
RETPUSHUNDEF;
#else
- DIE(no_sock_func, "listen");
+ DIE(PL_no_sock_func, "listen");
#endif
}
RETPUSHUNDEF;
#else
- DIE(no_sock_func, "accept");
+ DIE(PL_no_sock_func, "accept");
#endif
}
SETERRNO(EBADF,SS$_IVCHAN);
RETPUSHUNDEF;
#else
- DIE(no_sock_func, "shutdown");
+ DIE(PL_no_sock_func, "shutdown");
#endif
}
#ifdef HAS_SOCKET
return pp_ssockopt(ARGS);
#else
- DIE(no_sock_func, "getsockopt");
+ DIE(PL_no_sock_func, "getsockopt");
#endif
}
RETPUSHUNDEF;
#else
- DIE(no_sock_func, "setsockopt");
+ DIE(PL_no_sock_func, "setsockopt");
#endif
}
#ifdef HAS_SOCKET
return pp_getpeername(ARGS);
#else
- DIE(no_sock_func, "getsockname");
+ DIE(PL_no_sock_func, "getsockname");
#endif
}
RETPUSHUNDEF;
#else
- DIE(no_sock_func, "getpeername");
+ DIE(PL_no_sock_func, "getpeername");
#endif
}
PL_laststatval = PerlLIO_stat(SvPV(PL_statname, PL_na), &PL_statcache);
if (PL_laststatval < 0) {
if (ckWARN(WARN_NEWLINE) && strchr(SvPV(PL_statname, PL_na), '\n'))
- warner(WARN_NEWLINE, warn_nl, "stat");
+ warner(WARN_NEWLINE, PL_warn_nl, "stat");
max = 0;
}
}
if (result < 0)
RETPUSHUNDEF;
RETPUSHNO;
- } else
+ }
+ else
result = my_stat(ARGS);
#else
result = my_stat(ARGS);
#endif
+ SPAGAIN;
if (result < 0)
RETPUSHUNDEF;
if (cando(S_IRUSR, 0, &PL_statcache))
if (result < 0)
RETPUSHUNDEF;
RETPUSHNO;
- } else
+ }
+ else
result = my_stat(ARGS);
#else
result = my_stat(ARGS);
#endif
+ SPAGAIN;
if (result < 0)
RETPUSHUNDEF;
if (cando(S_IWUSR, 0, &PL_statcache))
if (result < 0)
RETPUSHUNDEF;
RETPUSHNO;
- } else
+ }
+ else
result = my_stat(ARGS);
#else
result = my_stat(ARGS);
#endif
+ SPAGAIN;
if (result < 0)
RETPUSHUNDEF;
if (cando(S_IXUSR, 0, &PL_statcache))
if (result < 0)
RETPUSHUNDEF;
RETPUSHNO;
- } else
+ }
+ else
result = my_stat(ARGS);
#else
result = my_stat(ARGS);
#endif
+ SPAGAIN;
if (result < 0)
RETPUSHUNDEF;
if (cando(S_IRUSR, 1, &PL_statcache))
if (result < 0)
RETPUSHUNDEF;
RETPUSHNO;
- } else
+ }
+ else
result = my_stat(ARGS);
#else
result = my_stat(ARGS);
#endif
+ SPAGAIN;
if (result < 0)
RETPUSHUNDEF;
if (cando(S_IWUSR, 1, &PL_statcache))
if (result < 0)
RETPUSHUNDEF;
RETPUSHNO;
- } else
+ }
+ else
result = my_stat(ARGS);
#else
result = my_stat(ARGS);
#endif
+ SPAGAIN;
if (result < 0)
RETPUSHUNDEF;
if (cando(S_IXUSR, 1, &PL_statcache))
#endif
if (i < 0) {
if (ckWARN(WARN_NEWLINE) && strchr(SvPV(sv, PL_na), '\n'))
- warner(WARN_NEWLINE, warn_nl, "open");
+ warner(WARN_NEWLINE, PL_warn_nl, "open");
RETPUSHUNDEF;
}
PL_laststatval = PerlLIO_fstat(i, &PL_statcache);
PUSHi(value);
RETURN;
#else
- DIE(no_func, "Unsupported function chown");
+ DIE(PL_no_func, "Unsupported function chown");
#endif
}
PUSHi( chroot(tmps) >= 0 );
RETURN;
#else
- DIE(no_func, "chroot");
+ DIE(PL_no_func, "chroot");
#endif
}
TAINT_PROPER("link");
SETi( link(tmps, tmps2) >= 0 );
#else
- DIE(no_func, "Unsupported function link");
+ DIE(PL_no_func, "Unsupported function link");
#endif
RETURN;
}
SETi( symlink(tmps, tmps2) >= 0 );
RETURN;
#else
- DIE(no_func, "symlink");
+ DIE(PL_no_func, "symlink");
#endif
}
SETERRNO(EBADF,RMS$_DIR);
RETPUSHUNDEF;
#else
- DIE(no_dir_func, "opendir");
+ DIE(PL_no_dir_func, "opendir");
#endif
}
else
RETPUSHUNDEF;
#else
- DIE(no_dir_func, "readdir");
+ DIE(PL_no_dir_func, "readdir");
#endif
}
SETERRNO(EBADF,RMS$_ISI);
RETPUSHUNDEF;
#else
- DIE(no_dir_func, "telldir");
+ DIE(PL_no_dir_func, "telldir");
#endif
}
SETERRNO(EBADF,RMS$_ISI);
RETPUSHUNDEF;
#else
- DIE(no_dir_func, "seekdir");
+ DIE(PL_no_dir_func, "seekdir");
#endif
}
SETERRNO(EBADF,RMS$_ISI);
RETPUSHUNDEF;
#else
- DIE(no_dir_func, "rewinddir");
+ DIE(PL_no_dir_func, "rewinddir");
#endif
}
SETERRNO(EBADF,RMS$_IFI);
RETPUSHUNDEF;
#else
- DIE(no_dir_func, "closedir");
+ DIE(PL_no_dir_func, "closedir");
#endif
}
PUSHi(childpid);
RETURN;
#else
- DIE(no_func, "Unsupported function fork");
+ DIE(PL_no_func, "Unsupported function fork");
#endif
}
XPUSHi(childpid);
RETURN;
#else
- DIE(no_func, "Unsupported function wait");
+ DIE(PL_no_func, "Unsupported function wait");
#endif
}
SETi(childpid);
RETURN;
#else
- DIE(no_func, "Unsupported function waitpid");
+ DIE(PL_no_func, "Unsupported function waitpid");
#endif
}
PUSHi(value);
RETURN;
#else
- DIE(no_func, "Unsupported function kill");
+ DIE(PL_no_func, "Unsupported function kill");
#endif
}
XPUSHi( getppid() );
RETURN;
#else
- DIE(no_func, "getppid");
+ DIE(PL_no_func, "getppid");
#endif
}
XPUSHi(value);
RETURN;
#else
- DIE(no_func, "getpgrp()");
+ DIE(PL_no_func, "getpgrp()");
#endif
}
#endif /* USE_BSDPGRP */
RETURN;
#else
- DIE(no_func, "setpgrp()");
+ DIE(PL_no_func, "setpgrp()");
#endif
}
SETi( getpriority(which, who) );
RETURN;
#else
- DIE(no_func, "getpriority()");
+ DIE(PL_no_func, "getpriority()");
#endif
}
SETi( setpriority(which, who, niceval) >= 0 );
RETURN;
#else
- DIE(no_func, "setpriority()");
+ DIE(PL_no_func, "setpriority()");
#endif
}
PUSHi((I32)anum);
RETURN;
#else
- DIE(no_func, "Unsupported function alarm");
+ DIE(PL_no_func, "Unsupported function alarm");
#endif
}
#ifdef HAS_GETHOSTBYNAME
return pp_ghostent(ARGS);
#else
- DIE(no_sock_func, "gethostbyname");
+ DIE(PL_no_sock_func, "gethostbyname");
#endif
}
#ifdef HAS_GETHOSTBYADDR
return pp_ghostent(ARGS);
#else
- DIE(no_sock_func, "gethostbyaddr");
+ DIE(PL_no_sock_func, "gethostbyaddr");
#endif
}
#ifdef HAS_GETHOSTBYNAME
hent = PerlSock_gethostbyname(POPp);
#else
- DIE(no_sock_func, "gethostbyname");
+ DIE(PL_no_sock_func, "gethostbyname");
#endif
else if (which == OP_GHBYADDR) {
#ifdef HAS_GETHOSTBYADDR
hent = PerlSock_gethostbyaddr(addr, (Netdb_hlen_t) addrlen, addrtype);
#else
- DIE(no_sock_func, "gethostbyaddr");
+ DIE(PL_no_sock_func, "gethostbyaddr");
#endif
}
else
#ifdef HAS_GETHOSTENT
hent = PerlSock_gethostent();
#else
- DIE(no_sock_func, "gethostent");
+ DIE(PL_no_sock_func, "gethostent");
#endif
#ifdef HOST_NOT_FOUND
}
RETURN;
#else
- DIE(no_sock_func, "gethostent");
+ DIE(PL_no_sock_func, "gethostent");
#endif
}
#ifdef HAS_GETNETBYNAME
return pp_gnetent(ARGS);
#else
- DIE(no_sock_func, "getnetbyname");
+ DIE(PL_no_sock_func, "getnetbyname");
#endif
}
#ifdef HAS_GETNETBYADDR
return pp_gnetent(ARGS);
#else
- DIE(no_sock_func, "getnetbyaddr");
+ DIE(PL_no_sock_func, "getnetbyaddr");
#endif
}
#ifdef HAS_GETNETBYNAME
nent = PerlSock_getnetbyname(POPp);
#else
- DIE(no_sock_func, "getnetbyname");
+ DIE(PL_no_sock_func, "getnetbyname");
#endif
else if (which == OP_GNBYADDR) {
#ifdef HAS_GETNETBYADDR
Netdb_net_t addr = (Netdb_net_t) U_L(POPn);
nent = PerlSock_getnetbyaddr(addr, addrtype);
#else
- DIE(no_sock_func, "getnetbyaddr");
+ DIE(PL_no_sock_func, "getnetbyaddr");
#endif
}
else
#ifdef HAS_GETNETENT
nent = PerlSock_getnetent();
#else
- DIE(no_sock_func, "getnetent");
+ DIE(PL_no_sock_func, "getnetent");
#endif
EXTEND(SP, 4);
RETURN;
#else
- DIE(no_sock_func, "getnetent");
+ DIE(PL_no_sock_func, "getnetent");
#endif
}
#ifdef HAS_GETPROTOBYNAME
return pp_gprotoent(ARGS);
#else
- DIE(no_sock_func, "getprotobyname");
+ DIE(PL_no_sock_func, "getprotobyname");
#endif
}
#ifdef HAS_GETPROTOBYNUMBER
return pp_gprotoent(ARGS);
#else
- DIE(no_sock_func, "getprotobynumber");
+ DIE(PL_no_sock_func, "getprotobynumber");
#endif
}
#ifdef HAS_GETPROTOBYNAME
pent = PerlSock_getprotobyname(POPp);
#else
- DIE(no_sock_func, "getprotobyname");
+ DIE(PL_no_sock_func, "getprotobyname");
#endif
else if (which == OP_GPBYNUMBER)
#ifdef HAS_GETPROTOBYNUMBER
pent = PerlSock_getprotobynumber(POPi);
#else
- DIE(no_sock_func, "getprotobynumber");
+ DIE(PL_no_sock_func, "getprotobynumber");
#endif
else
#ifdef HAS_GETPROTOENT
pent = PerlSock_getprotoent();
#else
- DIE(no_sock_func, "getprotoent");
+ DIE(PL_no_sock_func, "getprotoent");
#endif
EXTEND(SP, 3);
RETURN;
#else
- DIE(no_sock_func, "getprotoent");
+ DIE(PL_no_sock_func, "getprotoent");
#endif
}
#ifdef HAS_GETSERVBYNAME
return pp_gservent(ARGS);
#else
- DIE(no_sock_func, "getservbyname");
+ DIE(PL_no_sock_func, "getservbyname");
#endif
}
#ifdef HAS_GETSERVBYPORT
return pp_gservent(ARGS);
#else
- DIE(no_sock_func, "getservbyport");
+ DIE(PL_no_sock_func, "getservbyport");
#endif
}
sent = PerlSock_getservbyname(name, proto);
#else
- DIE(no_sock_func, "getservbyname");
+ DIE(PL_no_sock_func, "getservbyname");
#endif
}
else if (which == OP_GSBYPORT) {
#endif
sent = PerlSock_getservbyport(port, proto);
#else
- DIE(no_sock_func, "getservbyport");
+ DIE(PL_no_sock_func, "getservbyport");
#endif
}
else
#ifdef HAS_GETSERVENT
sent = PerlSock_getservent();
#else
- DIE(no_sock_func, "getservent");
+ DIE(PL_no_sock_func, "getservent");
#endif
EXTEND(SP, 4);
RETURN;
#else
- DIE(no_sock_func, "getservent");
+ DIE(PL_no_sock_func, "getservent");
#endif
}
PerlSock_sethostent(TOPi);
RETSETYES;
#else
- DIE(no_sock_func, "sethostent");
+ DIE(PL_no_sock_func, "sethostent");
#endif
}
PerlSock_setnetent(TOPi);
RETSETYES;
#else
- DIE(no_sock_func, "setnetent");
+ DIE(PL_no_sock_func, "setnetent");
#endif
}
PerlSock_setprotoent(TOPi);
RETSETYES;
#else
- DIE(no_sock_func, "setprotoent");
+ DIE(PL_no_sock_func, "setprotoent");
#endif
}
PerlSock_setservent(TOPi);
RETSETYES;
#else
- DIE(no_sock_func, "setservent");
+ DIE(PL_no_sock_func, "setservent");
#endif
}
EXTEND(SP,1);
RETPUSHYES;
#else
- DIE(no_sock_func, "endhostent");
+ DIE(PL_no_sock_func, "endhostent");
#endif
}
EXTEND(SP,1);
RETPUSHYES;
#else
- DIE(no_sock_func, "endnetent");
+ DIE(PL_no_sock_func, "endnetent");
#endif
}
EXTEND(SP,1);
RETPUSHYES;
#else
- DIE(no_sock_func, "endprotoent");
+ DIE(PL_no_sock_func, "endprotoent");
#endif
}
EXTEND(SP,1);
RETPUSHYES;
#else
- DIE(no_sock_func, "endservent");
+ DIE(PL_no_sock_func, "endservent");
#endif
}
#ifdef HAS_PASSWD
return pp_gpwent(ARGS);
#else
- DIE(no_func, "getpwnam");
+ DIE(PL_no_func, "getpwnam");
#endif
}
#ifdef HAS_PASSWD
return pp_gpwent(ARGS);
#else
- DIE(no_func, "getpwuid");
+ DIE(PL_no_func, "getpwuid");
#endif
}
}
RETURN;
#else
- DIE(no_func, "getpwent");
+ DIE(PL_no_func, "getpwent");
#endif
}
setpwent();
RETPUSHYES;
#else
- DIE(no_func, "setpwent");
+ DIE(PL_no_func, "setpwent");
#endif
}
endpwent();
RETPUSHYES;
#else
- DIE(no_func, "endpwent");
+ DIE(PL_no_func, "endpwent");
#endif
}
#ifdef HAS_GROUP
return pp_ggrent(ARGS);
#else
- DIE(no_func, "getgrnam");
+ DIE(PL_no_func, "getgrnam");
#endif
}
#ifdef HAS_GROUP
return pp_ggrent(ARGS);
#else
- DIE(no_func, "getgrgid");
+ DIE(PL_no_func, "getgrgid");
#endif
}
RETURN;
#else
- DIE(no_func, "getgrent");
+ DIE(PL_no_func, "getgrent");
#endif
}
setgrent();
RETPUSHYES;
#else
- DIE(no_func, "setgrent");
+ DIE(PL_no_func, "setgrent");
#endif
}
endgrent();
RETPUSHYES;
#else
- DIE(no_func, "endgrent");
+ DIE(PL_no_func, "endgrent");
#endif
}
PUSHp(tmps, strlen(tmps));
RETURN;
#else
- DIE(no_func, "getlogin");
+ DIE(PL_no_func, "getlogin");
#endif
}
PUSHi(retval);
RETURN;
#else
- DIE(no_func, "syscall");
+ DIE(PL_no_func, "syscall");
#endif
}