Remove some hacks and clean it up a little

This commit is contained in:
Ryan Voots 2017-05-21 11:52:28 -07:00
parent 8ce0412a8f
commit 66a2d6bd01
3 changed files with 9 additions and 5 deletions

View file

@ -1,5 +1,11 @@
Revision history for Sys::Linux::Namespaces
0.015 - May 21 2017
* Remove a few hacks for signals inside the child that aren't needed since using Linux::Clone instead of unshare only
0.014 - May 21 2017
* Return the exit code from waitpid so you can see the status of a process
0.013 - May 7 2017
* Force target mount option to be an absolute path
* Do kill child subprocess on any signal by default. This helps prevent zombie PID 1 processes.

View file

@ -21,8 +21,8 @@ sub debug {
print STDERR @_ if $debug;
}
our $VERSION = v0.013;
my @signames = keys %SIG; # capture before anyone has probably localized it.
our $VERSION = v0.015;
my @signames = grep {!/^__/} keys %SIG; # capture before anyone has probably localized it.
for my $p (qw/tmp mount pid net ipc user uts sysvsem/) {
my $pp = "private_$p";
@ -51,7 +51,6 @@ sub _subprocess {
debug "Forking\n";
my $pid = Linux::Clone::clone (sub {
local $$ = POSIX::getpid(); # try to fix up $$ if we can.
local %SIG = map {$_ => sub {debug "Got signal in $$, exiting"; _exit(0)}} @signames;
debug "Inside Child $$\n";
$code->(%args);
@ -60,7 +59,6 @@ sub _subprocess {
croak "Failed to fork: $!" if ($pid < 0);
my $sighandler =
local %SIG = map {my $q=$_; $q => sub {
debug "got signal $q in $$\n";
kill 'TERM', $pid;