From 79e83da7936995f247f7ad7ad0f768b6e2545cf1 Mon Sep 17 00:00:00 2001 From: kergoth Date: Tue, 15 Apr 2003 00:46:48 +0000 Subject: Only restart interface if it was UP previously. --- (limited to 'noncore') diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp index 8d78828..49a47ae 100644 --- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp +++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp @@ -47,36 +47,36 @@ bool InterfaceSetupImp::saveChanges(){ if(!saveSettings()) return false; - qWarning("restarting interface %s\n", iface.latin1()); interfaces->write(); - QString ifup; - ifup += "ifdown "; - ifup += iface; - ifup += "; ifup "; - ifup += iface; - ifup += ";"; - - OProcess restart; - restart << "sh"; - restart << "-c"; - restart << ifup; - - OWait *owait = new OWait(); - Global::statusMessage( tr( "Restarting interface" ) ); - - owait->show(); - qApp->processEvents(); - - if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) { - qWarning("unstable to spawn ifdown/ifup"); + if (interface->getStatus()) { + QString ifup; + ifup += "ifdown "; + ifup += iface; + ifup += "; ifup "; + ifup += iface; + ifup += ";"; + + OProcess restart; + restart << "sh"; + restart << "-c"; + restart << ifup; + + OWait *owait = new OWait(); + Global::statusMessage( tr( "Restarting interface" ) ); + + owait->show(); + qApp->processEvents(); + + if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) { + qWarning("unstable to spawn ifdown/ifup"); + } + + owait->hide(); + delete owait; + + interface->refresh(); } - - owait->hide(); - delete owait; - - interface->refresh(); - return true; } -- cgit v0.9.0.2