Skip to content

Commit

Permalink
Prevent NPE when backing up or restoring su binary
Browse files Browse the repository at this point in the history
  • Loading branch information
ChainsDD committed Jul 1, 2012
1 parent 9954c9d commit b52275c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/com/noshufou/android/su/util/Util.java
Expand Up @@ -647,15 +647,15 @@ public static boolean backupSu(Context context, boolean removeOriginal) {

os.writeBytes(suTools + " mount -o remount,rw /system\n");
String inLine = is.readLine();
if (!inLine.equals("0")) return false;
if (inLine == null || !inLine.equals("0")) return false;

os.writeBytes(suTools + " cp " + installedSu + " /system/bacon\n");
inLine = is.readLine();
if (!inLine.equals("0")) return false;
if (inLine == null || !inLine.equals("0")) return false;

os.writeBytes(suTools + " chmod 06755 /system/bacon\n");
inLine = is.readLine();
if (!inLine.equals("0")) return false;
if (inLine == null || !inLine.equals("0")) return false;

if (removeOriginal) {
os.writeBytes(suTools + " rm " + installedSu + "\n");
Expand Down Expand Up @@ -687,15 +687,15 @@ public static boolean restoreSu(Context context, boolean removeBackup, String ke

os.writeBytes(suTools + " mount -o remount,rw /system\n");
String inLine = is.readLine();
if (!inLine.equals("0")) return false;
if (inLine == null || !inLine.equals("0")) return false;

os.writeBytes(suTools + " cp /system/bacon /system/xbin/su\n");
inLine = is.readLine();
if (!inLine.equals("0")) return false;
if (inLine == null || !inLine.equals("0")) return false;

os.writeBytes(suTools + " chmod 06755 /system/xbin/su\n");
inLine = is.readLine();
if (!inLine.equals("0")) return false;
if (inLine == null || !inLine.equals("0")) return false;

if (removeBackup) {
os.writeBytes(suTools + " rm /system/bacon\n");
Expand Down

0 comments on commit b52275c

Please sign in to comment.