Skip to content

Commit

Permalink
Better parsing / splitting of mount results to fix nexus 6 problems
Browse files Browse the repository at this point in the history
  • Loading branch information
stealthcopter committed Apr 18, 2016
1 parent 8aeacef commit ed600d0
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions rootbeerlib/src/main/java/com/scottyab/rootbeer/RootBeer.java
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,30 @@ public boolean checkForRWPaths() {

String[] lines = mountReader();
for (String line : lines) {

// Split lines into parts
String[] args = line.split(" ");

if (args.length < 4){
// If we don't have enough options per line, skip this and log an error
QLog.e("Error formatting mount line: "+line);
continue;
}

String mountPoint = args[1];
String mountOptions = args[3];

for(String pathToCheck: Const.pathsThatShouldNotBeWrtiable) {
if (line.contains(pathToCheck)) {
if (line.contains(" rw,")) {
QLog.v(pathToCheck+" path is mounted with rw permissions!");
if (mountPoint.equalsIgnoreCase(pathToCheck)) {

// Split options out and compare against "rw" to avoid false positives
for (String option : mountOptions.split(",")){

if (option.equalsIgnoreCase("rw")){
QLog.v(pathToCheck+" path is mounted with rw permissions! "+line);
result = true;
break;
}
}
}
}
Expand Down

0 comments on commit ed600d0

Please sign in to comment.