Skip to content

Commit

Permalink
Merge pull request meefik#1142 from m0rtadelo/master
Browse files Browse the repository at this point in the history
FIX minor error
  • Loading branch information
meefik authored Dec 20, 2019
2 parents 91254aa + 62f607e commit ed58564
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions app/src/main/java/ru/meefik/linuxdeploy/EnvUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ private static boolean extractFile(Context c, String target, String rootAsset, S
AssetManager assetManager = c.getAssets();
InputStream in = null;
OutputStream out = null;
boolean result = true;
try {
in = assetManager.open(rootAsset + path);
File fname = new File(target + path);
Expand All @@ -62,12 +63,12 @@ private static boolean extractFile(Context c, String target, String rootAsset, S
out.flush();
} catch (IOException e) {
e.printStackTrace();
return false;
result = false;
} finally {
close(in);
close(out);
}
return true;
return result;
}

/**
Expand Down Expand Up @@ -150,6 +151,7 @@ private static boolean isRooted() {
boolean result = false;
OutputStream stdin = null;
InputStream stdout = null;
int n = 0;
try {
Process process = Runtime.getRuntime().exec("su");
stdin = process.getOutputStream();
Expand All @@ -167,7 +169,6 @@ private static boolean isRooted() {
close(os);
}

int n = 0;
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(stdout));
Expand All @@ -179,17 +180,13 @@ private static boolean isRooted() {
} finally {
close(reader);
}

if (n > 0) {
result = true;
}
} catch (IOException e) {
e.printStackTrace();
} finally {
close(stdout);
close(stdin);
}
return result;
return n > 0;
}

/**
Expand Down

0 comments on commit ed58564

Please sign in to comment.