# define OPEN_EXCL 0
#endif
-#if !defined(NSIG) || defined(M_UNIX) || defined(M_XENIX)
#include <signal.h>
-#endif
bool
Perl_do_open(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,num_svs,svp);
}
} /* !& */
+ if (!fp && type && *type && *type != ':' && !isIDFIRST(*type))
+ goto unknown_open_mode;
} /* IoTYPE_WRONLY */
else if (*type == IoTYPE_RDONLY) {
/*SUPPRESS 530*/
}
fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,num_svs,svp);
}
+ if (!fp && type && *type && *type != ':' && !isIDFIRST(*type))
+ goto unknown_open_mode;
} /* IoTYPE_RDONLY */
else if ((num_svs && /* '-|...' or '...|' */
type[0] == IoTYPE_STD && type[1] == IoTYPE_PIPE) ||
if (PL_filemode & (S_ISUID|S_ISGID)) {
PerlIO_flush(IoIFP(GvIOn(PL_argvoutgv))); /* chmod must follow last write */
#ifdef HAS_FCHMOD
- (void)fchmod(PL_lastfd,PL_filemode);
+ if (PL_lastfd != -1)
+ (void)fchmod(PL_lastfd,PL_filemode);
#else
(void)PerlLIO_chmod(PL_oldname,PL_filemode);
#endif
}
+ PL_lastfd = -1;
PL_filemode = 0;
if (!GvAV(gv))
return Nullfp;
if (PerlProc_pipe(fd) < 0)
goto badexit;
- IoIFP(rstio) = PerlIO_fdopen(fd[0], "r"PIPESOCK_MODE);
- IoOFP(wstio) = PerlIO_fdopen(fd[1], "w"PIPESOCK_MODE);
+ IoIFP(rstio) = PerlIO_fdopen(fd[0], "r"PIPE_OPEN_MODE);
+ IoOFP(wstio) = PerlIO_fdopen(fd[1], "w"PIPE_OPEN_MODE);
IoOFP(rstio) = IoIFP(rstio);
IoIFP(wstio) = IoOFP(wstio);
IoTYPE(rstio) = IoTYPE_RDONLY;
return (PL_laststatval = -1);
}
}
+ else if (PL_op->op_private & OPpFT_STACKED) {
+ return PL_laststatval;
+ }
else {
SV* sv = POPs;
char *s;
}
}
+static char no_prev_lstat[] = "The stat preceding -l _ wasn't an lstat";
+
I32
Perl_my_lstat(pTHX)
{
EXTEND(SP,1);
if (cGVOP_gv == PL_defgv) {
if (PL_laststype != OP_LSTAT)
- Perl_croak(aTHX_ "The stat preceding -l _ wasn't an lstat");
+ Perl_croak(aTHX_ no_prev_lstat);
return PL_laststatval;
}
if (ckWARN(WARN_IO)) {
return (PL_laststatval = -1);
}
}
+ else if (ckWARN(WARN_IO) && PL_laststype != OP_LSTAT
+ && (PL_op->op_private & OPpFT_STACKED))
+ Perl_croak(aTHX_ no_prev_lstat);
PL_laststype = OP_LSTAT;
PL_statgv = Nullgv;
while (*t && isSPACE(*t))
++t;
- if (!*t && (dup2(1,2) != -1)) {
+ if (!*t && (PerlLIO_dup2(1,2) != -1)) {
s[-2] = '\0';
break;
}
if (*cp == '?') *cp = '%'; /* VMS style single-char wildcard */
while (ok && ((sts = lib$find_file(&wilddsc,&rsdsc,&cxt,
&dfltdsc,NULL,NULL,NULL))&1)) {
- end = rstr + (unsigned long int) *rslt;
- if (!hasver) while (*end != ';') end--;
+ /* with varying string, 1st word of buffer contains result length */
+ end = rstr + *((unsigned short int*)rslt);
+ if (!hasver) while (*end != ';' && end > rstr) end--;
*(end++) = '\n'; *end = '\0';
for (cp = rstr; *cp; cp++) *cp = _tolower(*cp);
if (hasdir) {