diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-06-05 16:31:02 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-06-11 08:48:14 +0200 |
commit | 4a7f5a626835258b740c432e3a607b06a429ed33 (patch) | |
tree | ac2eb88e65f611ddedb25104d39cbec74c9e9742 /ext/IPC-Open3 | |
parent | 031f91ce84f46612589c760c55adb30af25b87b5 (diff) | |
download | perl-4a7f5a626835258b740c432e3a607b06a429ed33.tar.gz |
Avoid an uninitialized hash key in IPC::Open::spawn_with_handles().
Diffstat (limited to 'ext/IPC-Open3')
-rw-r--r-- | ext/IPC-Open3/lib/IPC/Open3.pm | 4 | ||||
-rw-r--r-- | ext/IPC-Open3/t/fd.t | 8 |
2 files changed, 4 insertions, 8 deletions
diff --git a/ext/IPC-Open3/lib/IPC/Open3.pm b/ext/IPC-Open3/lib/IPC/Open3.pm index 4396603144..dc19cea549 100644 --- a/ext/IPC-Open3/lib/IPC/Open3.pm +++ b/ext/IPC-Open3/lib/IPC/Open3.pm @@ -396,7 +396,9 @@ sub spawn_with_handles { unless eval { $fd->{handle}->isa('IO::Handle') } ; # If some of handles to redirect-to coincide with handles to # redirect, we need to use saved variants: - $fd->{handle}->fdopen($saved{fileno $fd->{open_as}} || $fd->{open_as}, + $fd->{handle}->fdopen(defined fileno $fd->{open_as} + ? $saved{fileno $fd->{open_as}} || $fd->{open_as} + : $fd->{open_as}, $fd->{mode}); } unless ($^O eq 'MSWin32') { diff --git a/ext/IPC-Open3/t/fd.t b/ext/IPC-Open3/t/fd.t index 7d4295ef3e..1e7632f254 100644 --- a/ext/IPC-Open3/t/fd.t +++ b/ext/IPC-Open3/t/fd.t @@ -14,7 +14,7 @@ BEGIN { use strict; use warnings; -plan 2; +plan 1; # [perl #76474] { @@ -23,12 +23,6 @@ plan 2; prog => 'open STDIN, q _Makefile_ or die $!; open3(q _<&1_, my $out, undef, $ENV{PERLEXE}, q _-e0_)', stderr => 1, ); - { - local $::TODO = "Bogus warning in IPC::Open3::spawn_with_handles" - if $^O eq 'MSWin32'; - $stderr =~ s/(Use of uninitialized value.*Open3\.pm line \d+\.)\n//; - is($1, undef, 'No bogus warning found'); - } is $stderr, '', "dup STDOUT in a child process by using its file descriptor"; |