X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=doio.c;h=664bd15a80ad2436c1600b359182ff5fbfdf5a38;hb=2aea4d4064eddefd1fbe7babfc1d07fc273740b9;hp=c7c6455dcd08c9ffb29f5fe7c5ab212433ad1177;hpb=a8710ca18eb34a984d0dfab8503448f77a53b379;p=p5sagit%2Fp5-mst-13.2.git diff --git a/doio.c b/doio.c index c7c6455..664bd15 100644 --- a/doio.c +++ b/doio.c @@ -1,6 +1,6 @@ /* doio.c * - * Copyright (c) 1991-1997, Larry Wall + * Copyright (c) 1991-1999, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -18,13 +18,12 @@ #include "perl.h" #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) +#ifndef HAS_SEM #include +#endif #ifdef HAS_MSG #include #endif -#ifdef HAS_SEM -#include -#endif #ifdef HAS_SHM #include # ifndef HAS_SHMAT_PROTOTYPE @@ -188,6 +187,13 @@ do_open(GV *gv, register char *name, I32 len, int as_raw, int rawmode, int rawpe if (*name == '|') { /*SUPPRESS 530*/ for (name++; isSPACE(*name); name++) ; + if (*name == '\0') { /* command is missing 19990114 */ + dTHR; + if (ckWARN(WARN_PIPE)) + warner(WARN_PIPE, "Missing command in piped open"); + errno = EPIPE; + goto say_false; + } if (strNE(name,"-")) TAINT_ENV(); TAINT_PROPER("piped open"); @@ -285,6 +291,13 @@ do_open(GV *gv, register char *name, I32 len, int as_raw, int rawmode, int rawpe name[--len] = '\0'; /*SUPPRESS 530*/ for (; isSPACE(*name); name++) ; + if (*name == '\0') { /* command is missing 19990114 */ + dTHR; + if (ckWARN(WARN_PIPE)) + warner(WARN_PIPE, "Missing command in piped open"); + errno = EPIPE; + goto say_false; + } if (strNE(name,"-")) TAINT_ENV(); TAINT_PROPER("piped open"); @@ -404,8 +417,8 @@ nextargv(register GV *gv) int filedev; int fileino; #endif - int fileuid; - int filegid; + Uid_t fileuid; + Gid_t filegid; if (!PL_argvoutgv) PL_argvoutgv = gv_fetchpv("ARGVOUT",TRUE,SVt_PVIO); @@ -470,7 +483,7 @@ nextargv(register GV *gv) || (_djstat_fail_bits & _STFAIL_TRUENAME)!=0 #endif ) { - warn("Can't do inplace edit: %s would not be uniq", + warn("Can't do inplace edit: %s would not be unique", SvPVX(sv) ); do_close(gv,FALSE); continue; @@ -781,7 +794,7 @@ do_binmode(PerlIO *fp, int iotype, int flag) if (flag != TRUE) croak("panic: unsetting binmode"); /* Not implemented yet */ #ifdef DOSISH -#ifdef atarist +#if defined(atarist) || defined(__MINT__) if (!PerlIO_flush(fp) && (fp->_flag |= _IOBIN)) return 1; else @@ -1153,7 +1166,7 @@ apply(I32 type, register SV **mark, register SV **sp) #define APPLY_TAINT_PROPER() \ STMT_START { \ - if (PL_tainting && PL_tainted) { goto taint_proper_label; } \ + if (PL_tainted) { TAINT_PROPER(what); } \ } STMT_END /* This is a first heuristic; it doesn't catch tainting magic. */ @@ -1311,18 +1324,18 @@ nothing in the core. struct utimbuf utbuf; #else struct { - long actime; - long modtime; + Time_t actime; + Time_t modtime; } utbuf; #endif Zero(&utbuf, sizeof utbuf, char); #ifdef BIG_TIME - utbuf.actime = (Time_t)SvNVx(*++mark); /* time accessed */ - utbuf.modtime = (Time_t)SvNVx(*++mark); /* time modified */ + utbuf.actime = (Time_t)SvNVx(*++mark); /* time accessed */ + utbuf.modtime = (Time_t)SvNVx(*++mark); /* time modified */ #else - utbuf.actime = SvIVx(*++mark); /* time accessed */ - utbuf.modtime = SvIVx(*++mark); /* time modified */ + utbuf.actime = (Time_t)SvIVx(*++mark); /* time accessed */ + utbuf.modtime = (Time_t)SvIVx(*++mark); /* time modified */ #endif APPLY_TAINT_PROPER(); tot = sp - mark; @@ -1340,10 +1353,6 @@ nothing in the core. } return tot; - taint_proper_label: - TAINT_PROPER(what); - return 0; /* this should never happen */ - #undef APPLY_TAINT_PROPER } @@ -1490,6 +1499,7 @@ do_ipcctl(I32 optype, SV **mark, SV **sp) #endif #ifdef HAS_SEM case OP_SEMCTL: +#ifdef Semctl if (cmd == IPC_STAT || cmd == IPC_SET) infosize = sizeof(struct semid_ds); else if (cmd == GETALL || cmd == SETALL) @@ -1505,6 +1515,9 @@ do_ipcctl(I32 optype, SV **mark, SV **sp) /* "short" is technically wrong but much more portable than guessing about u_?short(_t)? */ } +#else + croak("%s not implemented", PL_op_desc[optype]); +#endif break; #endif #if !defined(HAS_MSG) || !defined(HAS_SEM) || !defined(HAS_SHM) @@ -1546,10 +1559,14 @@ do_ipcctl(I32 optype, SV **mark, SV **sp) #endif #ifdef HAS_SEM case OP_SEMCTL: { +#ifdef Semctl union semun unsemds; unsemds.buf = (struct semid_ds *)a; ret = Semctl(id, n, cmd, unsemds); +#else + croak("%s not implemented", PL_op_desc[optype]); +#endif } break; #endif @@ -1606,12 +1623,6 @@ do_msgrcv(SV **mark, SV **sp) msize = SvIVx(*++mark); mtype = (long)SvIVx(*++mark); flags = SvIVx(*++mark); - if (SvTHINKFIRST(mstr)) { - if (SvREADONLY(mstr)) - croak("Can't msgrcv to readonly var"); - if (SvROK(mstr)) - sv_unref(mstr); - } SvPV_force(mstr, len); mbuf = SvGROW(mstr, sizeof(long)+msize+1);