Add 1 more byte to mark

Prevent crashes on higher Android versions
This commit is contained in:
topjohnwu 2018-08-09 03:01:33 +08:00
parent 5164cfd399
commit ff36f2ba17

View File

@ -147,7 +147,7 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
console.add("- Downloading zip"); console.add("- Downloading zip");
HttpURLConnection conn = WebService.mustRequest(Data.magiskLink, null); HttpURLConnection conn = WebService.mustRequest(Data.magiskLink, null);
buf = new BufferedInputStream(new ProgressStream(conn), conn.getContentLength()); buf = new BufferedInputStream(new ProgressStream(conn), conn.getContentLength());
buf.mark(conn.getContentLength()); buf.mark(conn.getContentLength() + 1);
try (OutputStream out = new FileOutputStream(zip)) { try (OutputStream out = new FileOutputStream(zip)) {
ShellUtils.pump(buf, out); ShellUtils.pump(buf, out);
} }
@ -156,7 +156,7 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
} else { } else {
console.add("- Existing zip found"); console.add("- Existing zip found");
buf = new BufferedInputStream(new FileInputStream(zip), (int) zip.length()); buf = new BufferedInputStream(new FileInputStream(zip), (int) zip.length());
buf.mark((int) zip.length()); buf.mark((int) zip.length() + 1);
} }
console.add("- Extracting files"); console.add("- Extracting files");