X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=doio.c;h=ef16b07906f19a2373d2c8d9cc66d37de3f3929e;hb=b2a156bd8e464af88881c77344280160fd844dcf;hp=29b5b19f508dfd8554ce813c2053b1a5ac4618d7;hpb=6fca0082ec4f3b34a0dabc78331bad8c22489dd2;p=p5sagit%2Fp5-mst-13.2.git diff --git a/doio.c b/doio.c index 29b5b19..ef16b07 100644 --- a/doio.c +++ b/doio.c @@ -1276,6 +1276,7 @@ Perl_my_stat(pTHX) if (gv == PL_defgv) return PL_laststatval; io = GvIO(gv); + do_fstat_have_io: PL_laststype = OP_STAT; PL_statgv = gv; sv_setpvn(PL_statname, "", 0); @@ -1287,6 +1288,7 @@ Perl_my_stat(pTHX) return (PL_laststatval = PerlLIO_fstat(dirfd(IoDIRP(io)), &PL_statcache)); #else Perl_die(aTHX_ PL_no_func, "dirfd"); + NORETURN_FUNCTION_END; #endif } else { if (ckWARN2(WARN_UNOPENED,WARN_CLOSED)) @@ -1315,6 +1317,11 @@ Perl_my_stat(pTHX) gv = (GV*)SvRV(sv); goto do_fstat; } + else if (SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PVIO) { + io = (IO*)SvRV(sv); + gv = NULL; + goto do_fstat_have_io; + } s = SvPV_const(sv, len); PL_statgv = NULL; @@ -1326,6 +1333,8 @@ Perl_my_stat(pTHX) Perl_warner(aTHX_ packWARN(WARN_NEWLINE), PL_warn_nl, "stat"); return PL_laststatval; } + /* Should we warn/croak here? Or do something smart/useful? */ + return (PL_laststatval = -1); } @@ -1475,7 +1484,7 @@ Perl_do_exec3(pTHX_ const char *incmd, int fd, int do_report) if (s[-1] == '\'') { *--s = '\0'; PERL_FPU_PRE_EXEC - PerlProc_execl(PL_cshname, "csh", flags, ncmd, NULL); + PerlProc_execl(PL_cshname, "csh", flags, ncmd, (char*)NULL); PERL_FPU_POST_EXEC *s = '\''; S_exec_failed(aTHX_ PL_cshname, fd, do_report); @@ -1524,7 +1533,7 @@ Perl_do_exec3(pTHX_ const char *incmd, int fd, int do_report) } doshell: PERL_FPU_PRE_EXEC - PerlProc_execl(PL_sh_path, "sh", "-c", cmd, NULL); + PerlProc_execl(PL_sh_path, "sh", "-c", cmd, (char *)NULL); PERL_FPU_POST_EXEC S_exec_failed(aTHX_ PL_sh_path, fd, do_report); Safefree(cmd); @@ -2245,7 +2254,8 @@ Perl_do_shmio(pTHX_ I32 optype, SV **mark, SV **sp) SETERRNO(0,0); if (shmctl(id, IPC_STAT, &shmds) == -1) return -1; - if (mpos < 0 || msize < 0 || (size_t)mpos + msize > shmds.shm_segsz) { + if (mpos < 0 || msize < 0 + || (size_t)mpos + msize > (size_t)shmds.shm_segsz) { SETERRNO(EFAULT,SS_ACCVIO); /* can't do as caller requested */ return -1; } @@ -2273,7 +2283,7 @@ Perl_do_shmio(pTHX_ I32 optype, SV **mark, SV **sp) STRLEN len; const char *mbuf = SvPV_const(mstr, len); - const I32 n = (len > msize) ? msize : len; + const I32 n = ((I32)len > msize) ? msize : (I32)len; Copy(mbuf, shm + mpos, n, char); if (n < msize) memzero(shm + mpos + n, msize - n);