if (io && (fp = IoIFP(io))) {
int fd = PerlIO_fileno(fp);
- if (fd >= 0) {
+ if (fd < 0 || (whence == SEEK_SET && pos < 0)) {
+ SETERRNO(EINVAL,LIB_INVARG);
+ return -1;
+ } else {
return PerlLIO_lseek(fd, pos, whence);
}
}
mbuf = SvGROW(mstr, sizeof(long)+msize+1);
SETERRNO(0,0);
- ret = msgrcv(id, (struct msgbuf *)mbuf, msize, mtype, flags);
+ if (id >= 0 && msize >= 0 && flags >= 0) {
+ ret = msgrcv(id, (struct msgbuf *)mbuf, msize, mtype, flags);
+ } else {
+ SETERRNO(EINVAL,LIB_INVARG);
+ ret = -1;
+ }
if (ret >= 0) {
SvCUR_set(mstr, sizeof(long)+ret);
*SvEND(mstr) = '\0';
SETERRNO(EFAULT,SS_ACCVIO); /* can't do as caller requested */
return -1;
}
- shm = (char *)shmat(id, NULL, (optype == OP_SHMREAD) ? SHM_RDONLY : 0);
+ if (id >= 0) {
+ shm = (char *)shmat(id, NULL, (optype == OP_SHMREAD) ? SHM_RDONLY : 0);
+ } else {
+ SETERRNO(EINVAL,LIB_INVARG);
+ return -1;
+ }
if (shm == (char *)-1) /* I hate System V IPC, I really do */
return -1;
if (optype == OP_SHMREAD) {
Function called by C<do_readline> to spawn a glob (or do the glob inside
perl on VMS). This code used to be inline, but now perl uses C<File::Glob>
this glob starter is only used by miniperl during the build process.
-Moving it away shrinks pp_hot.c; shrinking pp_hot.c helps speed perl up.
+Moving it away shrinks F<pp_hot.c>; shrinking F<pp_hot.c> helps speed perl up.
=cut
*/