From a6547a103a7f94f251bfdb01563052bba455f898 Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Sun, 8 Dec 2013 14:58:34 +0000 Subject: Avoid system() as this seems to crash net_applet. In what would appear to be related to threads and gtk3, calling system() here appears to crash net_applet(). We can avoid it by simply reading the network config. I'm not sure if a global $net variable is available here or if things could be re-engineered to pass this object in, but this seems like a quick and easy fix. mga#11929 --- lib/network/tools.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/network/tools.pm') diff --git a/lib/network/tools.pm b/lib/network/tools.pm index 951b445..c80c269 100644 --- a/lib/network/tools.pm +++ b/lib/network/tools.pm @@ -21,8 +21,14 @@ sub passwd_by_login { sub run_interface_command { my ($action, $intf, $detach) = @_; + my $have_perms = !$>; + if (!$have_perms) { + my $xxnet = {}; + network::network::read_net_conf($xxnet); + $have_perms = text2bool($xxnet->{ifcfg}{$intf}{USERCTL}); + } my @command = - !$> || system("/usr/sbin/usernetctl $intf report") == 0 ? + $have_perms ? ('/usr/sbin/if' . $action, $intf, if_(!$::isInstall, "daemon")) : ('/usr/bin/pkexec', '/usr/sbin/if' . $action, $intf); run_program::raw({ detach => $detach, root => $::prefix }, @command); -- cgit v1.2.1