summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-07-05 06:27:37 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-07-05 06:27:37 +0000
commit5081475eefaf24307ce7eaf4c87aafd588b37e98 (patch)
tree744b428598c31382b30b98187d16cb837b6db9ec /op.c
parentf6f9bdb7c056c5766371aa31d1a898fb878f3de5 (diff)
downloadperl-5081475eefaf24307ce7eaf4c87aafd588b37e98.tar.gz
add ck_sysread() for better sysread/read/recv sanity
p4raw-id: //depot/perl@1319
Diffstat (limited to 'op.c')
-rw-r--r--op.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/op.c b/op.c
index 1af6d964eb..fa5a60b362 100644
--- a/op.c
+++ b/op.c
@@ -4863,6 +4863,29 @@ ck_svconst(OP *o)
}
OP *
+ck_sysread(OP *o)
+{
+ if (o->op_flags & OPf_KIDS) {
+ /* get past pushmark */
+ OP *kid = cLISTOPo->op_first->op_sibling;
+ if (kid && (kid = kid->op_sibling)) {
+ switch (kid->op_type) {
+ case OP_HELEM:
+ case OP_AELEM:
+ case OP_SASSIGN:
+ case OP_AELEMFAST:
+ case OP_RV2SV:
+ case OP_PADSV:
+ break;
+ default:
+ bad_type(2, "scalar", op_desc[o->op_type], kid);
+ }
+ }
+ }
+ return ck_fun(o);
+}
+
+OP *
ck_trunc(OP *o)
{
if (o->op_flags & OPf_KIDS) {
@@ -4974,7 +4997,7 @@ peep(register OP *o)
case OP_PADAV:
if (o->op_next->op_type == OP_RV2AV
- && (o->op_next->op_flags && OPf_REF))
+ && (o->op_next->op_flags & OPf_REF))
{
null(o->op_next);
o->op_next = o->op_next->op_next;
@@ -4983,7 +5006,7 @@ peep(register OP *o)
case OP_PADHV:
if (o->op_next->op_type == OP_RV2HV
- && (o->op_next->op_flags && OPf_REF))
+ && (o->op_next->op_flags & OPf_REF))
{
null(o->op_next);
o->op_next = o->op_next->op_next;