From fec229793525b0614174b771bcb6fd72f8c047d8 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Wed, 10 Oct 2012 17:08:00 +0200 Subject: Fix bug that causes segfault on reconnect --- src/de/blinkt/openvpn/OpenVPNThread.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/de/blinkt/openvpn') diff --git a/src/de/blinkt/openvpn/OpenVPNThread.java b/src/de/blinkt/openvpn/OpenVPNThread.java index 0bde3205..b4ead269 100644 --- a/src/de/blinkt/openvpn/OpenVPNThread.java +++ b/src/de/blinkt/openvpn/OpenVPNThread.java @@ -37,13 +37,16 @@ public class OpenVPNThread implements Runnable { } catch (Exception e) { Log.e(TAG, "Got " + e.toString()); } finally { + int exitvalue = 0; try { - - } catch (Exception e) { - // ignore + exitvalue = mProcess.exitValue(); + } catch ( IllegalThreadStateException ite) { + OpenVPN.logError("Illegal Thread state: " + ite.getLocalizedMessage()); } - - OpenVPN.updateStateString("NOPROCESS","No process running"); + if( exitvalue != 0) + OpenVPN.logError("Process exited with exit value " + exitvalue); + + OpenVPN.updateStateString("NOPROCESS","No process running."); mService.processDied(); @@ -89,7 +92,7 @@ public class OpenVPNThread implements Runnable { return; OpenVPN.logMessage(0, "P:", logline); } - + } catch (IOException e) { OpenVPN.logMessage(0, "", "Error reading from output of OpenVPN process"+ e.getLocalizedMessage()); -- cgit v1.2.3