mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-23 11:21:29 +00:00
* Fix sending wrongly encoded commands into the unix subshell (fixes #1198)
This reverts commit 7541fa978e
.
This commit is contained in:
parent
b99d6d47d4
commit
5426e750ef
1 changed files with 6 additions and 3 deletions
|
@ -15,9 +15,11 @@ import android.widget.Toast;
|
||||||
import com.nutomic.syncthingandroid.R;
|
import com.nutomic.syncthingandroid.R;
|
||||||
import com.nutomic.syncthingandroid.service.Constants;
|
import com.nutomic.syncthingandroid.service.Constants;
|
||||||
|
|
||||||
|
import java.io.BufferedWriter;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
import eu.chainfire.libsuperuser.Shell;
|
import eu.chainfire.libsuperuser.Shell;
|
||||||
|
@ -178,9 +180,10 @@ public class Util {
|
||||||
try {
|
try {
|
||||||
shellProc = Runtime.getRuntime().exec((useRoot) ? "su" : "sh");
|
shellProc = Runtime.getRuntime().exec((useRoot) ? "su" : "sh");
|
||||||
shellOut = new DataOutputStream(shellProc.getOutputStream());
|
shellOut = new DataOutputStream(shellProc.getOutputStream());
|
||||||
|
BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(shellOut));
|
||||||
Log.d(TAG, "runShellCommand: " + cmd);
|
Log.d(TAG, "runShellCommand: " + cmd);
|
||||||
shellOut.writeBytes(cmd);
|
bufferedWriter.write(cmd);
|
||||||
shellOut.flush();
|
bufferedWriter.flush();
|
||||||
shellOut.close();
|
shellOut.close();
|
||||||
shellOut = null;
|
shellOut = null;
|
||||||
exitCode = shellProc.waitFor();
|
exitCode = shellProc.waitFor();
|
||||||
|
|
Loading…
Reference in a new issue