From e41cc779424eaf419bea11fb7535e356b1113698 Mon Sep 17 00:00:00 2001 From: Vincent Pit Date: Mon, 27 Jul 2009 14:47:26 +0200 Subject: [PATCH] Regression test for [perl #67912] --- t/op/sysio.t | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/t/op/sysio.t b/t/op/sysio.t index dd63a15..b4c2954 100644 --- a/t/op/sysio.t +++ b/t/op/sysio.t @@ -1,6 +1,6 @@ #!./perl -print "1..42\n"; +print "1..44\n"; chdir('op') || chdir('t/op') || die "sysio.t: cannot look for myself: $!"; @INC = '../../lib'; @@ -179,8 +179,6 @@ if ($reopen) { # must close file to update EOF marker for stat print 'not ' unless (-s $outfile == 10); print "ok 31\n"; -close(O); - open(I, $outfile) || die "sysio.t: cannot read $outfile: $!"; $b = 'xyz'; @@ -240,6 +238,17 @@ unlink $outfile; chdir('..'); +# [perl #67912] syswrite prints garbage if called with empty scalar and non-zero offset +eval { my $buf = ''; syswrite(O, $buf, 1, 0) }; +print 'not ' unless ($@ =~ /^Offset outside string /); +print "ok 43\n"; + +eval { my $buf = 'x'; syswrite(O, $buf, 1, 1) }; +print 'not ' unless ($@ =~ /^Offset outside string /); +print "ok 44\n"; + +close(O); + 1; # eof -- 2.7.4