Force RVALUE macros when in PERL_DEBUG_COW
[p5sagit/p5-mst-13.2.git] / pp_sys.c
index f96800a..300ea6d 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
 #   include <shadow.h>
 #endif
 
-#ifdef HAS_SYSCALL
-#ifdef __cplusplus
-extern "C" int syscall(unsigned long,...);
-#endif
-#endif
-
 #ifdef I_SYS_WAIT
 # include <sys/wait.h>
 #endif
@@ -329,7 +323,7 @@ PP(pp_backtick)
        mode = "rb";
     else if (PL_op->op_private & OPpOPEN_IN_CRLF)
        mode = "rt";
-    fp = PerlProc_popen(tmps, mode);
+    fp = PerlProc_popen(tmps, (char *)mode);
     if (fp) {
         const char *type = NULL;
        if (PL_curcop->cop_io) {
@@ -367,8 +361,7 @@ PP(pp_backtick)
                }
                XPUSHs(sv_2mortal(sv));
                if (SvLEN(sv) - SvCUR(sv) > 20) {
-                   SvLEN_set(sv, SvCUR(sv)+1);
-                   Renew(SvPVX(sv), SvLEN(sv), char);
+                   SvPV_shrink_to_cur(sv);
                }
                SvTAINTED_on(sv);
            }
@@ -1135,7 +1128,10 @@ PP(pp_sselect)
        }
     }
 
-    PUSHi(nfound);
+    if (nfound == -1)
+       PUSHs(&PL_sv_undef);
+    else
+       PUSHi(nfound);
     if (GIMME == G_ARRAY && tbuf) {
        value = (NV)(timebuf.tv_sec) +
                (NV)(timebuf.tv_usec) / 1000000.0;
@@ -1699,7 +1695,7 @@ PP(pp_sysread)
 
        read_target = sv_newmortal();
        SvUPGRADE(read_target, SVt_PV);
-       buffer = SvGROW(read_target, length + 1);
+       buffer = SvGROW(read_target, (STRLEN)(length + 1));
     }
 
     if (PL_op->op_type == OP_SYSREAD) {
@@ -1968,7 +1964,7 @@ PP(pp_eof)
                if ((IoFLAGS(io) & IOf_START) && av_len(GvAVn(gv)) < 0) {
                    IoLINES(io) = 0;
                    IoFLAGS(io) &= ~IOf_START;
-                   do_open(gv, "-", 1, FALSE, O_RDONLY, 0, Nullfp);
+                   do_open(gv, (char *)"-", 1, FALSE, O_RDONLY, 0, Nullfp);
                    sv_setpvn(GvSV(gv), "-", 1);
                    SvSETMAGIC(GvSV(gv));
                }
@@ -2110,7 +2106,6 @@ PP(pp_truncate)
      * might not be signed: if it is not, clever compilers will moan. */
     /* XXX Configure probe for the signedness of the length type of *truncate() needed? XXX */
     SETERRNO(0,0);
-#if defined(HAS_TRUNCATE) || defined(HAS_CHSIZE) || defined(F_FREESP)
     {
        int result = 1;
        GV *tmpgv;
@@ -2185,9 +2180,6 @@ PP(pp_truncate)
            SETERRNO(EBADF,RMS_IFI);
        RETPUSHUNDEF;
     }
-#else
-    DIE(aTHX_ "truncate not implemented");
-#endif
 }
 
 PP(pp_fcntl)