Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c04e1da authored by Steve Kondik's avatar Steve Kondik
Browse files

Fix mountpoint parsing

 * Not all systems follow the assumed format. New kernels do not
   include the "on" and "type" literals, and do not place
   parenthesis around the mount options.
 * Detect these conditions and do the right thing.

Change-Id: Ib88edf049e6a42cdab26274202f09de2bc19b493
parent dd4956d3
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -311,20 +311,29 @@ public final class ParseHelper {
            line = line.substring(pos).trim();
            // Skip "on"
            pos = line.indexOf(" "); //$NON-NLS-1$
            if ("on".equals(line.substring(0, pos).trim())) {
                line = line.substring(pos).trim();
            }
            // Mount point
            pos = line.indexOf(" "); //$NON-NLS-1$
            String mountPoint = line.substring(0, pos).trim();
            line = line.substring(pos).trim();
            // Skip "type"
            pos = line.indexOf(" "); //$NON-NLS-1$
            if ("type".equals(line.substring(0, pos).trim())) {
                line = line.substring(pos).trim();
            }
            // Type
            pos = line.indexOf(" "); //$NON-NLS-1$
            String type = line.substring(0, pos).trim();
            line = line.substring(pos).trim();
            // Options
            String options = line.substring(1, line.length() - 1).trim();
            String options;
            if (line.charAt(0) == '(') {
                options = line.substring(1, line.length() - 1).trim();
            } else {
                options = line.trim();
            }

            //Return the mount point
            return new MountPoint(mountPoint, device, type, options, /*dump*/0, /*pass*/0, false, false);