diff options
Diffstat (limited to 'perl-install/pkgs.pm')
-rw-r--r-- | perl-install/pkgs.pm | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index 820f888a1..77d0492f4 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -1478,7 +1478,17 @@ sub install($$$;$$) { close OUTPUT; #- now search for child process which may be locking the cdrom, making it unable to be ejected. - if (my @killpid = difference2([ grep { /^\d+$/ } all("/proc") ], \@prev_pids)) { + my @allpids = grep { /^\d+$/ } all("/proc"); + my %ppids; + foreach (@allpids) { + cat_("/proc/$_/status") =~ /^PPid:\s+(\d+)/m; + push @{$ppids{$1 || 1}}, $_; + } + my @killpid = difference2(\@allpids, [ @prev_pids, + difference2([ $$, hashtree2list(getppid, \%ppids) ], + [ hashtree2list($$, \%ppids) ]) ]); + + if (@killpid) { log::l("ERROR: DrakX should not have to clean the packages shit. Killing ". join(", ", @killpid)); kill 15, @killpid; sleep 2; @@ -1678,4 +1688,16 @@ ypserv } @naughtyServers; } +sub hashtree2list { + my ($e, $h) = @_; + my @l; + my @todo = $e; + while (@todo) { + my $e = shift @todo; + push @l, $e; + push @todo, @{$h->{$e}}; + } + @l; +} + 1; |