diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/net_applet | 54 |
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 { |