Skip to content

Commit ed58564

Browse files
authored
Merge pull request #1142 from m0rtadelo/master
FIX minor error
2 parents 91254aa + 62f607e commit ed58564

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

app/src/main/java/ru/meefik/linuxdeploy/EnvUtils.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ private static boolean extractFile(Context c, String target, String rootAsset, S
4949
AssetManager assetManager = c.getAssets();
5050
InputStream in = null;
5151
OutputStream out = null;
52+
boolean result = true;
5253
try {
5354
in = assetManager.open(rootAsset + path);
5455
File fname = new File(target + path);
@@ -62,12 +63,12 @@ private static boolean extractFile(Context c, String target, String rootAsset, S
6263
out.flush();
6364
} catch (IOException e) {
6465
e.printStackTrace();
65-
return false;
66+
result = false;
6667
} finally {
6768
close(in);
6869
close(out);
6970
}
70-
return true;
71+
return result;
7172
}
7273

7374
/**
@@ -150,6 +151,7 @@ private static boolean isRooted() {
150151
boolean result = false;
151152
OutputStream stdin = null;
152153
InputStream stdout = null;
154+
int n = 0;
153155
try {
154156
Process process = Runtime.getRuntime().exec("su");
155157
stdin = process.getOutputStream();
@@ -167,7 +169,6 @@ private static boolean isRooted() {
167169
close(os);
168170
}
169171

170-
int n = 0;
171172
BufferedReader reader = null;
172173
try {
173174
reader = new BufferedReader(new InputStreamReader(stdout));
@@ -179,17 +180,13 @@ private static boolean isRooted() {
179180
} finally {
180181
close(reader);
181182
}
182-
183-
if (n > 0) {
184-
result = true;
185-
}
186183
} catch (IOException e) {
187184
e.printStackTrace();
188185
} finally {
189186
close(stdout);
190187
close(stdin);
191188
}
192-
return result;
189+
return n > 0;
193190
}
194191

195192
/**

0 commit comments

Comments
 (0)