summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pp_sys.c3
-rw-r--r--t/op/dbm.t9
2 files changed, 11 insertions, 1 deletions
diff --git a/pp_sys.c b/pp_sys.c
index c7212b3f32..71c5ca741d 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1017,7 +1017,10 @@ PP(pp_dbmopen)
if (SvIV(right))
mPUSHu(O_RDWR|O_CREAT);
else
+ {
mPUSHu(O_RDWR);
+ if (!SvOK(right)) right = &PL_sv_no;
+ }
PUSHs(right);
PUTBACK;
call_sv(MUTABLE_SV(GvCV(gv)), G_SCALAR);
diff --git a/t/op/dbm.t b/t/op/dbm.t
index c9add50140..9e81f590ed 100644
--- a/t/op/dbm.t
+++ b/t/op/dbm.t
@@ -9,7 +9,7 @@ BEGIN {
skip_all("No dbm functions") if $@;
}
-plan tests => 4;
+plan tests => 5;
# This is [20020104.007] "coredump on dbmclose"
@@ -58,3 +58,10 @@ fresh_perl_like($prog, qr/No dbm on this machine/, {},
fresh_perl_like('delete $::{"AnyDBM_File::"}; ' . $prog,
qr/No dbm on this machine/, {},
'implicit require and no stash fails');
+
+{ # undef 3rd arg
+ local $^W = 1;
+ local $SIG{__WARN__} = sub { ++$w };
+ dbmopen(%truffe, 'pleaseletthisfilenotexist', undef);
+ is $w, 1, '1 warning from dbmopen with undef third arg';
+}