diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-02-22 10:42:31 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-02-22 10:42:31 +0000 |
commit | 9562c5d46175f75515afff8b1005a12002b231e8 (patch) | |
tree | f37d66a52d62a2ccab9b6624996edacd14516c72 /perl-install/pkgs.pm | |
parent | 629cc2139ddd2d2b2ea3ff321802cdba050aec02 (diff) | |
download | drakx-9562c5d46175f75515afff8b1005a12002b231e8.tar drakx-9562c5d46175f75515afff8b1005a12002b231e8.tar.gz drakx-9562c5d46175f75515afff8b1005a12002b231e8.tar.bz2 drakx-9562c5d46175f75515afff8b1005a12002b231e8.tar.xz drakx-9562c5d46175f75515afff8b1005a12002b231e8.zip |
even smarted process to kill selection
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; |