summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-02-22 10:42:31 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-02-22 10:42:31 +0000
commit9562c5d46175f75515afff8b1005a12002b231e8 (patch)
treef37d66a52d62a2ccab9b6624996edacd14516c72
parent629cc2139ddd2d2b2ea3ff321802cdba050aec02 (diff)
downloaddrakx-backup-do-not-use-9562c5d46175f75515afff8b1005a12002b231e8.tar
drakx-backup-do-not-use-9562c5d46175f75515afff8b1005a12002b231e8.tar.gz
drakx-backup-do-not-use-9562c5d46175f75515afff8b1005a12002b231e8.tar.bz2
drakx-backup-do-not-use-9562c5d46175f75515afff8b1005a12002b231e8.tar.xz
drakx-backup-do-not-use-9562c5d46175f75515afff8b1005a12002b231e8.zip
even smarted process to kill selection
-rw-r--r--perl-install/pkgs.pm24
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;