| 1 | package Net::SSH::Any::OS::POSIX; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use POSIX (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use Fcntl (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 3 | ▶ | use Socket; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 3 | ▶ | use Net::SSH::Any::Util qw($debug _debug _debug_hexdump _first_defined _warn); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 3 | ▶ | use Net::SSH::Any::Constants qw(:error); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 3 | ▶ | use File::Spec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 3 | ▶ | use Time::HiRes (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 3 | ▶ | use Errno; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 3 | require Net::SSH::Any::OS::_Base; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 3 | our @ISA = qw(Net::SSH::Any::OS::_Base); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | ▶ | sub _fileno_dup_over { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fileno_dup_over: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | my ($good_fn, $fh) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | if (defined $fh) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | my $fn = fileno $fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | for (1..5) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | $fn >= $good_fn and return $fn; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | $fn = POSIX::dup($fn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | POSIX::_exit(255); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | sub has_working_socketpair { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_working_socketpair: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | sub socketpair { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
socketpair: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | my $any = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | my ($a, $b); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | unless (CORE::socketpair($a, $b, AF_UNIX, SOCK_STREAM, PF_UNSPEC)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | $any->_set_error(SSHA_LOCAL_IO_ERROR, "socketpair failed: $!"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | $debug and $debug & 1024 and _debug "socketpair => $a (", fileno($a), "), $b (", fileno($b), ")"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$Net::SSH::Any::OS::POSIX::debug and $Net::SSH::Any::OS::POSIX::debug & 1024
MC/DC0%0/2
$Net::SSH::Any::OS::POSIX::debug and $Net::SSH::Any::OS::POSIX::debug & 1024
$Net::SSH::Any::OS::POSIX::debug
$Net::SSH::Any::OS::POSIX::debug & 1024
Truth table0%0/3
A and B
A= $Net::SSH::Any::OS::POSIX::debugB= $Net::SSH::Any::OS::POSIX::debug & 1024
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ($a, $b); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub make_dpipe { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_dpipe: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | my ($any, $proc, $dpipe, $out) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | defined $out and die "internal error: out should be undefined but is $out"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | require Net::SSH::Any::OS::POSIX::DPipe; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | Net::SSH::Any::OS::POSIX::DPipe->_upgrade_fh_to_dpipe($dpipe, $any, $proc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | $dpipe; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | sub pipe { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pipe: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | my $any = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | my ($r, $w); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | unless (CORE::pipe $r, $w) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | $any->_set_error(SSHA_LOCAL_IO_ERROR, "Unable to create pipe: $!"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | $debug and $debug & 1024 and _debug "pipe => $r (", fileno($r), "), $w (", fileno($w), ")"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$Net::SSH::Any::OS::POSIX::debug and $Net::SSH::Any::OS::POSIX::debug & 1024
MC/DC0%0/2
$Net::SSH::Any::OS::POSIX::debug and $Net::SSH::Any::OS::POSIX::debug & 1024
$Net::SSH::Any::OS::POSIX::debug
$Net::SSH::Any::OS::POSIX::debug & 1024
Truth table0%0/3
A and B
A= $Net::SSH::Any::OS::POSIX::debugB= $Net::SSH::Any::OS::POSIX::debug & 1024
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ($r, $w); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | sub open4 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
open4: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | my ($any, $fhs, $close, $pty, $stderr_to_stdout, @cmd) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | my $pid = fork; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | unless ($pid) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | unless (defined $pid) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | $any->_set_error(SSHA_CONNECTION_ERROR, "unable to fork new process: $!"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | $pty->make_slave_controlling_terminal if $pty; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | my @fds = map _fileno_dup_over(3 => $_), @$fhs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | close $_ for grep defined, @$close; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | for (0..2) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | my $fd = $fds[$_]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | POSIX::dup2($fd, $_) if defined $fd; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | POSIX::dup2(1, 2) if $stderr_to_stdout; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | do { exec @cmd }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | POSIX::_exit(255); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | return { pid => $pid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 3 | my @retriable = (Errno::EINTR, Errno::EAGAIN); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 3 | push @retriable, Errno::EWOULDBLOCK if Errno::EWOULDBLOCK != Errno::EAGAIN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | sub io3 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
io3: not called CC=53 SCAR=79.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | my ($any, $proc, $timeout, $data, $in, $out, $err) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | my ($cin, $cout, $cerr) = map defined, $in, $out, $err; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | $timeout = $any->{timeout} unless defined $timeout; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | # removes undefs and zero length strings and copies the data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | # string so that we can modify them in place | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | $data = $any->_os_io3_check_and_clean_data($data, $in); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | if ($cin and not @$data) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$cin and not @$data
MC/DC0%0/2
$cin and not @$data
$cin
not @$data
Truth table0%0/3
A and not(B)
A= $cinB= not @$data
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | close $in; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | undef $cin; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | my $bout = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | my $berr = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | my ($fnoout, $fnoerr, $fnoin); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | local $SIG{PIPE} = 'IGNORE'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | MLOOP: while ($cout or $cerr or $cin) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$cout or $cerr or $cin
$cout or $cerr
MC/DC0%0/3
$cout or $cerr or $cin
$cout
$cerr
$cin
Truth table0%0/4
A or B or C
A= $coutB= $cerrC= $cin
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | $debug and $debug & 1024 and _debug "io3 mloop, cin: " . ($cin || 0) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$Net::SSH::Any::OS::POSIX::debug and $Net::SSH::Any::OS::POSIX::debug & 1024
$cin || 0
$cout || 0
$cerr || 0
MC/DC0%0/2
$Net::SSH::Any::OS::POSIX::debug and $Net::SSH::Any::OS::POSIX::debug & 1024
$Net::SSH::Any::OS::POSIX::debug
$Net::SSH::Any::OS::POSIX::debug & 1024
MC/DC0%0/1
$cin || 0
$cin
MC/DC0%0/1
$cout || 0
$cout
MC/DC0%0/1
$cerr || 0
$cerr
Truth table0%0/3
A and B
A= $Net::SSH::Any::OS::POSIX::debugB= $Net::SSH::Any::OS::POSIX::debug & 1024
Truth table0%0/2
A
A= $cin
Truth table0%0/2
A
A= $cout
Truth table0%0/2
A
A= $cerr
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | ", cout: " . ($cout || 0) . ", cerr: " . ($cerr || 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | my ($rv, $wv); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | if ($cout or $cerr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$cout or $cerr
MC/DC0%0/2
$cout or $cerr
$cout
$cerr
Truth table0%0/3
A or B
A= $coutB= $cerr
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | $rv = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | if ($cout) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | $fnoout = fileno $out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | vec($rv, $fnoout, 1) = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | if ($cerr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | $fnoerr = fileno $err; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | vec($rv, $fnoerr, 1) = 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | if ($cin) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | $fnoin = fileno $in; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | $wv = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | vec($wv, $fnoin, 1) = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | my $recalc_vecs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | FAST: until ($recalc_vecs) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | $debug and $debug & 1024 and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$Net::SSH::Any::OS::POSIX::debug and $Net::SSH::Any::OS::POSIX::debug & 1024
$cin || 0
$cout || 0
$cerr || 0
MC/DC0%0/2
$Net::SSH::Any::OS::POSIX::debug and $Net::SSH::Any::OS::POSIX::debug & 1024
$Net::SSH::Any::OS::POSIX::debug
$Net::SSH::Any::OS::POSIX::debug & 1024
MC/DC0%0/1
$cin || 0
$cin
MC/DC0%0/1
$cout || 0
$cout
MC/DC0%0/1
$cerr || 0
$cerr
Truth table0%0/3
A and B
A= $Net::SSH::Any::OS::POSIX::debugB= $Net::SSH::Any::OS::POSIX::debug & 1024
Truth table0%0/2
A
A= $cin
Truth table0%0/2
A
A= $cout
Truth table0%0/2
A
A= $cerr
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | _debug "io3 fast, cin: " . ($cin || 0) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | ", cout: " . ($cout || 0) . ", cerr: " . ($cerr || 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | my ($rv1, $wv1) = ($rv, $wv); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | my $n = select ($rv1, $wv1, undef, $timeout); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | if ($n > 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | if ($cout and vec($rv1, $fnoout, 1)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$cout and vec $rv1, $fnoout, 1
MC/DC0%0/2
$cout and vec $rv1, $fnoout, 1
$cout
vec $rv1, $fnoout, 1
Truth table0%0/3
A and B
A= $coutB= vec $rv1, $fnoout, 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | my $offset = length $bout; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | my $read = sysread($out, $bout, 20480, $offset); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | $debug and $debug & 1024 and _debug "stdout, bytes read: ", $read, " at offset $offset"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$Net::SSH::Any::OS::POSIX::debug and $Net::SSH::Any::OS::POSIX::debug & 1024
MC/DC0%0/2
$Net::SSH::Any::OS::POSIX::debug and $Net::SSH::Any::OS::POSIX::debug & 1024
$Net::SSH::Any::OS::POSIX::debug
$Net::SSH::Any::OS::POSIX::debug & 1024
Truth table0%0/3
A and B
A= $Net::SSH::Any::OS::POSIX::debugB= $Net::SSH::Any::OS::POSIX::debug & 1024
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | unless ($read) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | if (defined $read or not grep $! == $_, @retriable) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $read or not grep(($! == $_), @retriable)
MC/DC0%0/2
defined $read or not grep(($! == $_), @retriable)
defined $read
not grep(($! == $_), @retriable)
Truth table0%0/3
A or not(B)
A= defined $readB= not grep(($! == $_), @retriable)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | close $out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | undef $cout; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | $recalc_vecs = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | if ($cerr and vec($rv1, $fnoerr, 1)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$cerr and vec $rv1, $fnoerr, 1
MC/DC0%0/2
$cerr and vec $rv1, $fnoerr, 1
$cerr
vec $rv1, $fnoerr, 1
Truth table0%0/3
A and B
A= $cerrB= vec $rv1, $fnoerr, 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | my $read = sysread($err, $berr, 20480, length($berr)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | $debug and $debug & 1024 and _debug "stderr, bytes read: ", $read; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$Net::SSH::Any::OS::POSIX::debug and $Net::SSH::Any::OS::POSIX::debug & 1024
MC/DC0%0/2
$Net::SSH::Any::OS::POSIX::debug and $Net::SSH::Any::OS::POSIX::debug & 1024
$Net::SSH::Any::OS::POSIX::debug
$Net::SSH::Any::OS::POSIX::debug & 1024
Truth table0%0/3
A and B
A= $Net::SSH::Any::OS::POSIX::debugB= $Net::SSH::Any::OS::POSIX::debug & 1024
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | unless ($read) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | if (defined $read or not grep $! == $_, @retriable) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $read or not grep(($! == $_), @retriable)
MC/DC0%0/2
defined $read or not grep(($! == $_), @retriable)
defined $read
not grep(($! == $_), @retriable)
Truth table0%0/3
A or not(B)
A= defined $readB= not grep(($! == $_), @retriable)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | close $err; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | undef $cerr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | $recalc_vecs = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | if ($cin and vec($wv1, $fnoin, 1)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$cin and vec $wv1, $fnoin, 1
MC/DC0%0/2
$cin and vec $wv1, $fnoin, 1
$cin
vec $wv1, $fnoin, 1
Truth table0%0/3
A and B
A= $cinB= vec $wv1, $fnoin, 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | my $written = syswrite($in, $data->[0], 20480); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | $debug and $debug & 64 and _debug "stdin, bytes written: ", $written; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$Net::SSH::Any::OS::POSIX::debug and $Net::SSH::Any::OS::POSIX::debug & 64
MC/DC0%0/2
$Net::SSH::Any::OS::POSIX::debug and $Net::SSH::Any::OS::POSIX::debug & 64
$Net::SSH::Any::OS::POSIX::debug
$Net::SSH::Any::OS::POSIX::debug & 64
Truth table0%0/3
A and B
A= $Net::SSH::Any::OS::POSIX::debugB= $Net::SSH::Any::OS::POSIX::debug & 64
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | if ($written) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | substr($data->[0], 0, $written, ''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | next FAST if length $data->[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | shift @$data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | next FAST if @$data; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | # fallback when stdin queue is exhausted | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | elsif (grep $! == $_, @retriable) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | next FAST; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | close $in; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | undef $cin; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | $recalc_vecs = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | next if $n < 0 and grep $! == $_, @retriable; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$n < 0 and grep(($! == $_), @retriable)
MC/DC0%0/2
$n < 0 and grep(($! == $_), @retriable)
$n < 0
grep(($! == $_), @retriable)
Truth table0%0/3
A and B
A= $n < 0B= grep(($! == $_), @retriable)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | $any->_set_error(SSHA_TIMEOUT_ERROR, 'slave command timed out'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | last MLOOP; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | close $out if $cout; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | close $err if $cerr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | close $in if $cin; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | $any->_wait_ssh_proc($proc, $timeout); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | $debug and $debug & 1024 and _debug "leaving io3()"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$Net::SSH::Any::OS::POSIX::debug and $Net::SSH::Any::OS::POSIX::debug & 1024
MC/DC0%0/2
$Net::SSH::Any::OS::POSIX::debug and $Net::SSH::Any::OS::POSIX::debug & 1024
$Net::SSH::Any::OS::POSIX::debug
$Net::SSH::Any::OS::POSIX::debug & 1024
Truth table0%0/3
A and B
A= $Net::SSH::Any::OS::POSIX::debugB= $Net::SSH::Any::OS::POSIX::debug & 1024
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | return ($bout, $berr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 3 | my @base_app_dirs = qw(/usr/lib /opt /usr/local); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 3 | ▶ | sub find_cmd_by_app { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_cmd_by_app: called CC=8 SCAR=25.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 3 | my ($any, $name, $app) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 3 | ▶ | $app = $app->{POSIX} if ref $app; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 3 | ▶ | if (defined $app) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 3 | for my $app ($app, lc($app)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 6 | for my $base (@base_app_dirs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 18 | my $app_dir = "$base/$app"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 18 | ▶ | if (-d $app_dir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | for my $bin (qw(bin sbin libexec .)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | my $path = $any->_os_validate_cmd("$app_dir/$bin/$name"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | ▶ | defined $path and return $path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 3 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 3 | ▶ | sub find_user_dirs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_user_dirs: called CC=5 SCAR=17.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 3 | my $any = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 3 | my $home = (getpwuid $<)[7]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 3 | my @dirs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 3 | for my $name (@_) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 3 | ▶ | my $posix_name = (ref $name ? $name->{POSIX} : $name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 3 | ▶ | if (defined $posix_name and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $posix_name and defined $home
MC/DC0%0/2
defined $posix_name and defined $home
defined $posix_name
defined $home
Truth table33%1/3
A and B
A= defined $posix_nameB= defined $home
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | defined $home) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 3 | push @dirs, join('/', $home, $posix_name) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 3 | grep -d $_, @dirs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | sub set_file_inherit_flag { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_file_inherit_flag: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | my ($any, $file, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | ▶ | $debug and $debug & 1024 and _debug "setting inherit flag for file $file (",fileno($file),") to $value"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$Net::SSH::Any::OS::POSIX::debug and $Net::SSH::Any::OS::POSIX::debug & 1024
MC/DC0%0/2
$Net::SSH::Any::OS::POSIX::debug and $Net::SSH::Any::OS::POSIX::debug & 1024
$Net::SSH::Any::OS::POSIX::debug
$Net::SSH::Any::OS::POSIX::debug & 1024
Truth table0%0/3
A and B
A= $Net::SSH::Any::OS::POSIX::debugB= $Net::SSH::Any::OS::POSIX::debug & 1024
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | my $flags = fcntl($file, Fcntl::F_GETFL(), 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | if ($value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | $flags &= ~Fcntl::FD_CLOEXEC(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | $flags |= Fcntl::FD_CLOEXEC(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | fcntl($file, Fcntl::F_SETFL(), $flags); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 3 | my $unique_ix = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | ▶ | sub create_secret_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_secret_file: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | my ($any, $name, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | my $home = (getpwuid $<)[7]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | ▶ | unless (defined $home) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | $any->_os_set_error(SSHA_LOCAL_IO_ERROR, "Unable to determine user home directory: $!"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | my $base = File::Spec->rel2abs('.libssh-net-any-perl', $home); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | ▶ | mkdir $base, 0700 unless -d $base; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | ▶ | unless (do { local $!; -d $base }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | $any->_or_set_error(SSHA_LOCAL_IO_ERROR, "Unable to create private directory $base: $!"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | $name = File::Spec->rel2abs($name, $base); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | my $ext = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | ▶ | if ($name =~ m|(.*)(\.[^/]*)$|) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | $name = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | $ext = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | my $final = join("-", $name, $$, $unique_ix++, int rand 1000).$ext; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | if (sysopen(my $fh, $final, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | Fcntl::O_RDWR()|Fcntl::O_CREAT()|Fcntl::O_EXCL(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | Fcntl::S_IRUSR()|Fcntl::S_IWUSR())) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | print {$fh} $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | return $final if close $fh; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | $any->_or_set_error(SSHA_LOCAL_IO_ERROR, "Unable to write secret file $final: $!"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | unlink $final; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | unless ($! == Errno::EEXIST()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | $any->_or_set_error(SSHA_LOCAL_IO_ERROR, "Unable to create secret file $final: $!"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | sub unix_path { $_[1] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unix_path: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | ▶ | sub version { 'POSIX' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
version: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||