summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorEugeni Dodonov <eugeni@mandriva.org>2009-10-26 22:29:08 +0000
committerEugeni Dodonov <eugeni@mandriva.org>2009-10-26 22:29:08 +0000
commitdb7b8c3833c1af1bdbfeaddfcd6680278c557704 (patch)
treef3b8ab7e5edb72a5518e5b3e0b558ac87f873ccf /bin
parenta379293fa9b132c2abf2bbffab2605d6f5d41418 (diff)
downloaddrakx-net-db7b8c3833c1af1bdbfeaddfcd6680278c557704.tar
drakx-net-db7b8c3833c1af1bdbfeaddfcd6680278c557704.tar.gz
drakx-net-db7b8c3833c1af1bdbfeaddfcd6680278c557704.tar.bz2
drakx-net-db7b8c3833c1af1bdbfeaddfcd6680278c557704.tar.xz
drakx-net-db7b8c3833c1af1bdbfeaddfcd6680278c557704.zip
properly treat children processes (#54636) in net_applet
Diffstat (limited to 'bin')
-rwxr-xr-xbin/net_applet54
1 files changed, 42 insertions, 12 deletions
diff --git a/bin/net_applet b/bin/net_applet
index 5c9d640..8ededfd 100755
--- a/bin/net_applet
+++ b/bin/net_applet
@@ -127,6 +127,13 @@ sub get_interface_name {
$type_name ? "$type_name ($interface)" : $interface;
}
+sub ignore_children(&) {
+ my ($f) = @_;
+ # do not create zombies (#20552)
+ local $SIG{CHLD} = 'IGNORE';
+ &$f;
+}
+
my %actions = (
'upNetwork' => { name => sub { N("Connect %s", get_interface_name($_[0])) }, launch => sub { network::tools::start_interface($_[0], 1) } },
'downNetwork' => { name => sub { N("Disconnect %s", get_interface_name($_[0])) }, launch => sub { network::tools::stop_interface($_[0], 1) } },
@@ -135,10 +142,18 @@ my %actions = (
'wireless' => { name => N("Manage wireless networks"), launch => sub { run_drakroam() } },
'drakvpn' => {
name => N("Manage VPN connections"), launch => sub {
- run_program::raw({ detach => 1 }, '/usr/sbin/drakvpn');
+ ignore_children {
+ run_program::raw({ detach => 1 }, '/usr/sbin/drakvpn');
+ };
},
},
- 'confNetwork' => { name => N("Configure Network"), launch => sub { system("/usr/sbin/drakconnect &") } },
+ 'confNetwork' => {
+ name => N("Configure Network"), launch => sub {
+ ignore_children {
+ system("/usr/sbin/drakconnect &");
+ };
+ }
+ },
'chooseInterface' => {
name => N("Watched interface"),
choices => sub { N("Auto-detect"), sort keys %{$net->{ifcfg}} },
@@ -173,9 +188,11 @@ my %actions = (
choices => sub { network::network::netprofile_list() },
choice_selected => sub { $_[0] eq $net->{PROFILE} },
launch => sub {
- require run_program;
- $net->{PROFILE} = $_[0];
- run_program::raw({ detach => 1 }, common::wrap_command_for_root('/sbin/set-netprofile', $net->{PROFILE}));
+ ignore_children {
+ require run_program;
+ $net->{PROFILE} = $_[0];
+ run_program::raw({ detach => 1 }, common::wrap_command_for_root('/sbin/set-netprofile', $net->{PROFILE}));
+ };
}
},
'chooseVPN' => {
@@ -187,7 +204,14 @@ my %actions = (
choice_selected => sub { $_[0]->is_started },
launch => sub { require interactive; $_[0]->is_started ? $_[0]->stop : $_[0]->start(interactive->vnew) },
},
- 'help' => { name => N("Help"), launch => sub { system("drakhelp --id internet-connection &") } },
+ 'help' => {
+ name => N("Help"),
+ launch => sub {
+ ignore_children {
+ system("drakhelp --id internet-connection &");
+ };
+ },
+ },
'quit' => { name => N("Quit"), launch => \&mainQuit },
);
@@ -245,8 +269,6 @@ $SIG{USR1} = sub {
my @packets = eval { $network::net_applet::ifw->get_reports };
};
-# do not create zombies (#20552)
-$SIG{CHLD} = 'IGNORE';
Gtk2->main;
@@ -280,21 +302,29 @@ sub shouldStart() {
return getAutoStart();
}
sub run_net_monitor() {
- run_program::raw({ detach => 1 }, '/usr/bin/net_monitor', '--defaultintf', $current_interface) unless is_running('net_monitor');
+ ignore_children {
+ run_program::raw({ detach => 1 }, '/usr/bin/net_monitor', '--defaultintf', $current_interface) unless is_running('net_monitor');
+ };
}
sub run_netcenter() {
- run_program::raw({ detach => 1 }, '/usr/bin/draknetcenter') unless is_running('draknetcenter', 'root');
+ ignore_children {
+ run_program::raw({ detach => 1 }, '/usr/bin/draknetcenter') unless is_running('draknetcenter', 'root');
+ };
}
sub run_drakroam {
my ($o_ap) = @_;
- run_program::raw({ detach => 1 }, '/usr/sbin/drakroam', if_($o_ap, "--ap=$o_ap")) unless is_running('drakroam', 'root');
+ ignore_children {
+ run_program::raw({ detach => 1 }, '/usr/sbin/drakroam', if_($o_ap, "--ap=$o_ap")) unless is_running('drakroam', 'root');
+ };
}
sub run_drakids() {
$ifw_alert = 0;
if (is_running('drakids')) {
eval { $ifw->send_manage_request };
} else {
- run_program::raw({ detach => 1 }, '/usr/sbin/drakids');
+ ignore_children {
+ run_program::raw({ detach => 1 }, '/usr/sbin/drakids');
+ };
}
}
sub generate_wireless_menuitem {