diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2002-01-25 21:37:03 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2002-01-25 21:37:03 +0000 |
commit | b5d2fea7d685aa8937f7ded78f879c6c841bf93a (patch) | |
tree | 6e787459ee30cddb77d10dcf060cc53e0f994c5c /ext | |
parent | d5b53b20fa4fb4addda7b1ca4ad0ea6095f136b8 (diff) | |
download | perl-b5d2fea7d685aa8937f7ded78f879c6c841bf93a.tar.gz |
Save $! so that other syscalls don't disturb it before
we test it.
p4raw-id: //depot/perlio@14422
Diffstat (limited to 'ext')
-rw-r--r-- | ext/Socket/socketpair.t | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ext/Socket/socketpair.t b/ext/Socket/socketpair.t index 639606a3e9..d14ccb44d9 100644 --- a/ext/Socket/socketpair.t +++ b/ext/Socket/socketpair.t @@ -9,7 +9,7 @@ BEGIN { require Config; import Config; $can_fork = $Config{d_fork} || ($^O eq 'MSWin32' && $Config{useithreads}); - if ($^O eq "hpux" or $Config{'extensions'} !~ /\bSocket\b/ && + if ($^O eq "hpux" or $Config{'extensions'} !~ /\bSocket\b/ && !(($^O eq 'VMS') && $Config{d_socket})) { print "1..0\n"; exit 0; @@ -110,18 +110,25 @@ ok (shutdown(LEFT, SHUT_WR), "shutdown left for writing"); alarm 60; } +my $err = $!; $SIG{PIPE} = 'IGNORE'; { local $SIG{ALRM} = sub { warn "syswrite to left didn't fail within 3 seconds" }; alarm 3; - is (syswrite (LEFT, "void"), undef, "syswrite to shutdown left should fail"); + # Split the system call from the is() - is() does IO so + # (say) a flush may do a seek which on a pipe may disturb errno + my $ans = syswrite (LEFT, "void"); + $err = $!; + is ($ans, undef, "syswrite to shutdown left should fail"); alarm 60; } { - # This may need skipping on some OSes + # This may need skipping on some OSes - restoring value saved above + # should help + $! = $err; ok (($!{EPIPE} or $!{ESHUTDOWN}), '$! should be EPIPE or ESHUTDOWN') - or printf "\$\!=%d(%s)\n", $!, $!; + or printf "\$\!=%d(%s)\n", $err, $err; } my @gripping = (chr 255, chr 127); |