else
fp = PerlIO_open(name,mode);
}
- else if (name[len-1] == '|') {
+ else if (len > 1 && name[len-1] == '|') {
name[--len] = '\0';
while (len && isSPACE(name[len-1]))
name[--len] = '\0';
(void)fchown(lastfd,fileuid,filegid);
#else
#ifdef HAS_CHOWN
- (void)chown(oldname,fileuid,filegid);
+ (void)PerlLIO_chown(oldname,fileuid,filegid);
#endif
#endif
}
if (!gv)
gv = argvgv;
if (!gv || SvTYPE(gv) != SVt_PVGV) {
- SETERRNO(EBADF,SS$_IVCHAN);
+ if (not_implicit)
+ SETERRNO(EBADF,SS$_IVCHAN);
return FALSE;
}
io = GvIO(gv);
if (!io) { /* never opened */
- if (dowarn && not_implicit)
- warn("Close on unopened file <%s>",GvENAME(gv));
- SETERRNO(EBADF,SS$_IVCHAN);
+ if (not_implicit) {
+ if (dowarn)
+ warn("Close on unopened file <%s>",GvENAME(gv));
+ SETERRNO(EBADF,SS$_IVCHAN);
+ }
return FALSE;
}
retval = io_close(io);
* document this anywhere). GSAR 97-5-24
*/
PerlIO_seek(fp,0L,0);
- fp->flags |= _F_BIN;
+ ((FILE*)fp)->flags |= _F_BIN;
#endif
return 1;
}
SV **oldmark = mark;
#define APPLY_TAINT_PROPER() \
- if (!(tainting && tainted)) {} else { goto taint_proper; }
+ STMT_START { \
+ if (tainting && tainted) { goto taint_proper_label; } \
+ } STMT_END
/* This is a first heuristic; it doesn't catch tainting magic. */
if (tainting) {
while (++mark <= sp) {
char *name = SvPVx(*mark, na);
APPLY_TAINT_PROPER();
- if (chown(name, val, val2))
+ if (PerlLIO_chown(name, val, val2))
tot--;
}
}
}
return tot;
- taint_proper:
+ taint_proper_label:
TAINT_PROPER(what);
return 0; /* this should never happen */
semun.buf = &semds;
getinfo = (cmd == GETALL);
+ if (Semctl(id, 0, IPC_STAT, semun) == -1)
+ return -1;
infosize = semds.sem_nsems * sizeof(short);
/* "short" is technically wrong but much more portable
than guessing about u_?short(_t)? */