SV *sv;
PerlLIO_dup2(PerlIO_fileno(fp), fd);
- MUTEX_LOCK(&PL_fdpid_mutex);
+ LOCK_FDPID_MUTEX;
sv = *av_fetch(PL_fdpid,PerlIO_fileno(fp),TRUE);
(void)SvUPGRADE(sv, SVt_IV);
pid = SvIVX(sv);
SvIVX(sv) = 0;
sv = *av_fetch(PL_fdpid,fd,TRUE);
- MUTEX_UNLOCK(&PL_fdpid_mutex);
+ UNLOCK_FDPID_MUTEX;
(void)SvUPGRADE(sv, SVt_IV);
SvIVX(sv) = pid;
if (!was_fdopen)
IoFLAGS(io) &= ~IOf_NOLINE;
if (writing) {
dTHR;
- bool is_reg = IoTYPE(io) == '>' && S_ISCHR(PL_statbuf.st_mode);
- if (IoTYPE(io) == 's' || is_reg)
+ if (IoTYPE(io) == 's'
+ || (IoTYPE(io) == '>' && S_ISCHR(PL_statbuf.st_mode)) )
{
char *mode;
if (out_raw)
IoIFP(io) = Nullfp;
goto say_false;
}
- else {
- if (is_reg)
- IoIFP(io) = IoOFP(io); /* avoid double close() */
- }
}
else
IoOFP(io) = fp;
id = SvIVx(*++mark);
mstr = *++mark;
+ /* suppress warning when reading into undef var --jhi */
+ if (! SvOK(mstr))
+ sv_setpvn(mstr, "", 0);
msize = SvIVx(*++mark);
mtype = (long)SvIVx(*++mark);
flags = SvIVx(*++mark);