author | kergoth <kergoth> | 2003-04-15 00:46:48 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-04-15 00:46:48 (UTC) |
commit | 79e83da7936995f247f7ad7ad0f768b6e2545cf1 (patch) (unidiff) | |
tree | a0c1d7c382d6374c2c941b30a00515cbdcfd9270 | |
parent | f3905e771c1abd5fdc430aba364934b717dfa115 (diff) | |
download | opie-79e83da7936995f247f7ad7ad0f768b6e2545cf1.zip opie-79e83da7936995f247f7ad7ad0f768b6e2545cf1.tar.gz opie-79e83da7936995f247f7ad7ad0f768b6e2545cf1.tar.bz2 |
Only restart interface if it was UP previously.
-rw-r--r-- | noncore/settings/networksettings/interfaces/interfacesetupimp.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
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 | |||
@@ -38,27 +38,27 @@ InterfaceSetupImp::~InterfaceSetupImp(){ | |||
38 | } | 38 | } |
39 | } | 39 | } |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * Save the current settings, then write out the interfaces file and close. | 42 | * Save the current settings, then write out the interfaces file and close. |
43 | */ | 43 | */ |
44 | bool InterfaceSetupImp::saveChanges(){ | 44 | bool InterfaceSetupImp::saveChanges(){ |
45 | bool error; | 45 | bool error; |
46 | QString iface = interfaces->getInterfaceName(error); | 46 | QString iface = interfaces->getInterfaceName(error); |
47 | if(!saveSettings()) | 47 | if(!saveSettings()) |
48 | return false; | 48 | return false; |
49 | 49 | ||
50 | qWarning("restarting interface %s\n", iface.latin1()); | ||
51 | interfaces->write(); | 50 | interfaces->write(); |
52 | 51 | ||
52 | if (interface->getStatus()) { | ||
53 | QString ifup; | 53 | QString ifup; |
54 | ifup += "ifdown "; | 54 | ifup += "ifdown "; |
55 | ifup += iface; | 55 | ifup += iface; |
56 | ifup += "; ifup "; | 56 | ifup += "; ifup "; |
57 | ifup += iface; | 57 | ifup += iface; |
58 | ifup += ";"; | 58 | ifup += ";"; |
59 | 59 | ||
60 | OProcess restart; | 60 | OProcess restart; |
61 | restart << "sh"; | 61 | restart << "sh"; |
62 | restart << "-c"; | 62 | restart << "-c"; |
63 | restart << ifup; | 63 | restart << ifup; |
64 | 64 | ||
@@ -67,25 +67,25 @@ bool InterfaceSetupImp::saveChanges(){ | |||
67 | 67 | ||
68 | owait->show(); | 68 | owait->show(); |
69 | qApp->processEvents(); | 69 | qApp->processEvents(); |
70 | 70 | ||
71 | if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) { | 71 | if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) { |
72 | qWarning("unstable to spawn ifdown/ifup"); | 72 | qWarning("unstable to spawn ifdown/ifup"); |
73 | } | 73 | } |
74 | 74 | ||
75 | owait->hide(); | 75 | owait->hide(); |
76 | delete owait; | 76 | delete owait; |
77 | 77 | ||
78 | interface->refresh(); | 78 | interface->refresh(); |
79 | 79 | } | |
80 | return true; | 80 | return true; |
81 | } | 81 | } |
82 | 82 | ||
83 | /** | 83 | /** |
84 | * Save the settings for the current Interface. | 84 | * Save the settings for the current Interface. |
85 | * @return bool true if successfull, false otherwise | 85 | * @return bool true if successfull, false otherwise |
86 | */ | 86 | */ |
87 | bool InterfaceSetupImp::saveSettings(){ | 87 | bool InterfaceSetupImp::saveSettings(){ |
88 | // eh can't really do anything about it other then return. :-D | 88 | // eh can't really do anything about it other then return. :-D |
89 | if(!interfaces->isInterfaceSet()) | 89 | if(!interfaces->isInterfaceSet()) |
90 | return true; | 90 | return true; |
91 | 91 | ||