| 1 | package Unix::SavedIDs; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 4 | ▶ | use constant { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 4 | TYPE_UID => 0, | |||||||||||||||||||||||||||
| 9 | TYPE_GID => 1, | ||||||||||||||||||||||||||||
| 10 | 4 | }; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 4 | our $DEBUG = 0; | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 4 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 4 | ▶ | use Exporter (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 4 | our ($VERSION,@ISA,@EXPORT); | |||||||||||||||||||||||||||
| 18 | 4 | @ISA = qw(Exporter); | |||||||||||||||||||||||||||
| 19 | 4 | @EXPORT = qw(getresuid getresgid setresuid setresgid | |||||||||||||||||||||||||||
| 20 | ); | ||||||||||||||||||||||||||||
| 21 | 4 | $VERSION = 0.004003; | |||||||||||||||||||||||||||
| 22 | 4 | ▶ | use XSLoader; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 4 | XSLoader::load('Unix::SavedIDs',$VERSION); | |||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | ▶ | sub setresuid { | ||||||||||||||||||||||||||
|
Subroutine
setresuid: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 27 | 0 | my @args = eval {_clean_args(@_) }; | |||||||||||||||||||||||||||
| 28 | 0 | ▶ | if ( $@ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | 0 | croak "setresuid(): $@"; | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | 0 | _setresuid(@args); | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | sub setresgid { | ||||||||||||||||||||||||||
|
Subroutine
setresgid: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 35 | 0 | my @args = eval {_clean_args(@_) }; | |||||||||||||||||||||||||||
| 36 | 0 | ▶ | if ( $@ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | 0 | croak "setresgid(): $@"; | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | 0 | _setresgid(@args); | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 0 | ▶ | sub _clean_args { | ||||||||||||||||||||||||||
|
Subroutine
_clean_args: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||
| 43 | 0 | my @args = @_; | |||||||||||||||||||||||||||
| 44 | 0 | my $is_int = qr/^-?\d+$/o; | |||||||||||||||||||||||||||
| 45 | 0 | for my $num ( 0 .. 2 ) { | |||||||||||||||||||||||||||
| 46 | 0 | ▶ | if ( !exists($args[$num]) || !defined($args[$num]) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $args[$num] && defined $args[$num]
MC/DC0%0/2
exists $args[$num] && defined $args[$num]
exists $args[$num]
defined $args[$num]
Truth table0%0/3
A && B
A= exists $args[$num]B= defined $args[$num]
| |||||||||||||||||||||||||||||
| 47 | 0 | $args[$num] = -1; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | else { | ||||||||||||||||||||||||||||
| 50 | 0 | ▶ | if ( $args[$num] !~ $is_int ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | 0 | croak 'bad arg \''.$args[$num].'\'. Must be int.'."\n"; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | 0 | ▶ | if (@args != 3) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 56 | 0 | die "_clean_args should always produce 3 args. THIS IS A BUG!"; | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | 0 | return @args; | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 4 | 1; | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | __END__ | ||||||||||||||||||||||||||||