summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-09-13 10:10:46 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-09-13 10:10:46 +0000
commit12a3ea34277fde944bdd2b019439ddae1f3648ec (patch)
treee09b646c1fae6da3afd4885f65ff388d0f6404d9
parent1eba42a99f26f70d2365970c8c51a13b0ad7ffb1 (diff)
downloadperl-12a3ea34277fde944bdd2b019439ddae1f3648ec.tar.gz
Apparently at some point doing 3-arg open with
illegal mode like ">>>" had stopped croaking. p4raw-id: //depot/perl@21206
-rw-r--r--doio.c4
-rwxr-xr-xt/io/open.t15
2 files changed, 18 insertions, 1 deletions
diff --git a/doio.c b/doio.c
index 0c105191be..3bad8f343b 100644
--- a/doio.c
+++ b/doio.c
@@ -422,6 +422,8 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,num_svs,svp);
}
} /* !& */
+ if (!fp && type && *type && *type != ':' && !isIDFIRST(*type))
+ goto unknown_open_mode;
} /* IoTYPE_WRONLY */
else if (*type == IoTYPE_RDONLY) {
/*SUPPRESS 530*/
@@ -453,6 +455,8 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
}
fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,num_svs,svp);
}
+ if (!fp && type && *type && *type != ':' && !isIDFIRST(*type))
+ goto unknown_open_mode;
} /* IoTYPE_RDONLY */
else if ((num_svs && /* '-|...' or '...|' */
type[0] == IoTYPE_STD && type[1] == IoTYPE_PIPE) ||
diff --git a/t/io/open.t b/t/io/open.t
index 87a9c5580b..b8020c24c3 100755
--- a/t/io/open.t
+++ b/t/io/open.t
@@ -12,7 +12,7 @@ use Config;
$Is_VMS = $^O eq 'VMS';
$Is_MacOS = $^O eq 'MacOS';
-plan tests => 100;
+plan tests => 102;
my $Perl = which_perl();
@@ -279,3 +279,16 @@ SKIP: {
like($@, qr/<\$fh3{...}> line 1\./, "autoviv fh lexical helem");
}
+SKIP: {
+ skip("This test uses perlio", 1) unless $Config{useperlio};
+ my $w;
+ use warnings 'layer';
+ local $SIG{__WARN__} = sub { $w = shift };
+
+ eval { open(F, ">>>", "afile") };
+ like($w, qr/perlio: invalid separator character '>' in layer spec/,
+ "bad open warning");
+ like($@, qr/Unknown open\(\) mode '>>>'/,
+ "bad open failure");
+}
+