Diffstat (limited to 'noncore/applets/wirelessapplet') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/applets/wirelessapplet/wireless.cpp | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/noncore/applets/wirelessapplet/wireless.cpp b/noncore/applets/wirelessapplet/wireless.cpp index 649cf20..fb9522a 100644 --- a/noncore/applets/wirelessapplet/wireless.cpp +++ b/noncore/applets/wirelessapplet/wireless.cpp | |||
@@ -54,3 +54,3 @@ | |||
54 | 54 | ||
55 | //#define MDEBUG 0 | 55 | //#define MDEBUG |
56 | #undef MDEBUG | 56 | #undef MDEBUG |
@@ -248,5 +248,8 @@ void WirelessApplet::renewDHCP() | |||
248 | QString ifacename( interface->getName() ); | 248 | QString ifacename( interface->getName() ); |
249 | |||
250 | // At first we are trying dhcpcd | ||
251 | |||
249 | pidfile.sprintf( "/var/run/dhcpcd-%s.pid", (const char* ) ifacename ); | 252 | pidfile.sprintf( "/var/run/dhcpcd-%s.pid", (const char* ) ifacename ); |
250 | #ifdef MDEBUG | 253 | #ifdef MDEBUG |
251 | qDebug( "WIFIAPPLET: pidfile is '%s'", (const char*) pidfile ); | 254 | qDebug( "WIFIAPPLET: dhcpcd pidfile is '%s'", (const char*) pidfile ); |
252 | #endif | 255 | #endif |
@@ -257,8 +260,31 @@ void WirelessApplet::renewDHCP() | |||
257 | if ( hasFile ) | 260 | if ( hasFile ) |
261 | { | ||
258 | s >> pid; | 262 | s >> pid; |
259 | #ifdef MDEBUG | 263 | #ifdef MDEBUG |
260 | qDebug( "WIFIAPPLET: sent -14 to pid %d", pid ); | 264 | qDebug( "WIFIAPPLET: sent SIGALARM to pid %d", pid ); |
261 | #endif | 265 | #endif |
262 | kill( pid, -14 ); | 266 | kill( pid, SIGALRM ); |
267 | return; | ||
268 | } | ||
263 | 269 | ||
270 | // No dhcpcd, so we are trying udhcpc | ||
271 | #ifdef MDEBUG | ||
272 | qDebug( "WIFIAPPLET: dhcpcd not available." ); | ||
273 | #endif | ||
274 | pidfile.sprintf( "/var/run/udhcpc.%s.pid", (const char*) ifacename ); | ||
275 | #ifdef MDEBUG | ||
276 | qDebug( "WIFIAPPLET: udhcpc pidfile is '%s'", (const char*) pidfile ); | ||
277 | #endif | ||
278 | QFile pfile2( pidfile ); | ||
279 | hasFile = pfile2.open( IO_ReadOnly ); | ||
280 | QTextStream s2( &pfile2 ); | ||
281 | if ( hasFile ) | ||
282 | { | ||
283 | s2 >> pid; | ||
284 | #ifdef MDEBUG | ||
285 | qDebug( "WIFIAPPLET: sent SIGUSR1 to pid %d", pid ); | ||
286 | #endif | ||
287 | kill( pid, SIGUSR1 ); | ||
288 | return; | ||
289 | } | ||
264 | } | 290 | } |