Defer to fstype2 if found. Use auto fs if two fstypes are specified
Change-Id: Id6ee1fed1eebbaa6d3a9e6117910f00a56378da4
diff --git a/extendedcommands.c b/extendedcommands.c
index 6b2b582..c6e9dc2 100644
--- a/extendedcommands.c
+++ b/extendedcommands.c
@@ -974,7 +974,7 @@
fprintf(file, "%s ", device);
fprintf(file, "%s ", path);
- fprintf(file, "%s rw\n", vol->fs_type);
+ fprintf(file, "%s rw\n", vol->fs_type2 != NULL ? "auto" : vol->fs_type);
}
void create_fstab()
diff --git a/roots.c b/roots.c
index 5df84d3..7c4e241 100644
--- a/roots.c
+++ b/roots.c
@@ -159,31 +159,16 @@
} else if (strcmp(v->fs_type, "ext4") == 0 ||
strcmp(v->fs_type, "ext3") == 0 ||
strcmp(v->fs_type, "vfat") == 0) {
- if ((result = try_mount(v->device, v->mount_point, v->fs_type)) == 0)
- return 0;
- if ((result = try_mount(v->device2, v->mount_point, v->fs_type)) == 0)
- return 0;
+ // try fs type 2 first
if ((result = try_mount(v->device, v->mount_point, v->fs_type2)) == 0)
return 0;
if ((result = try_mount(v->device2, v->mount_point, v->fs_type2)) == 0)
return 0;
+ if ((result = try_mount(v->device, v->mount_point, v->fs_type)) == 0)
+ return 0;
+ if ((result = try_mount(v->device2, v->mount_point, v->fs_type)) == 0)
+ return 0;
return result;
- /*
- result = mount(v->device, v->mount_point, v->fs_type,
- MS_NOATIME | MS_NODEV | MS_NODIRATIME, "");
- if (result == 0) return 0;
-
- if (v->device2) {
- LOGW("failed to mount %s (%s); trying %s\n",
- v->device, strerror(errno), v->device2);
- result = mount(v->device2, v->mount_point, v->fs_type,
- MS_NOATIME | MS_NODEV | MS_NODIRATIME, "");
- if (result == 0) return 0;
- }
-
- LOGE("failed to mount %s (%s)\n", v->mount_point, strerror(errno));
- return -1;
- */
} else {
// let's try mounting with the mount binary and hope for the best.
char mount_cmd[PATH_MAX];