summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2013-12-08 14:58:34 +0000
committerColin Guthrie <colin@mageia.org>2013-12-08 14:59:35 +0000
commita6547a103a7f94f251bfdb01563052bba455f898 (patch)
tree538e85743b512e757bf1a07f30dc0df123a04b03
parent1eb8f0fa6c27bc508d0cfa442c21f1a22f943532 (diff)
downloaddrakx-net-a6547a103a7f94f251bfdb01563052bba455f898.tar
drakx-net-a6547a103a7f94f251bfdb01563052bba455f898.tar.gz
drakx-net-a6547a103a7f94f251bfdb01563052bba455f898.tar.bz2
drakx-net-a6547a103a7f94f251bfdb01563052bba455f898.tar.xz
drakx-net-a6547a103a7f94f251bfdb01563052bba455f898.zip
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
-rw-r--r--NEWS2
-rw-r--r--lib/network/tools.pm8
2 files changed, 9 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index df4cdd5..0890c40 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- avoid system() as this seems to segv perl when combined with threads (mga#11929)
+
2.2
- fix "undefined value for mandatory argument 'sensitive'" (mga#11799)
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);