Created
January 22, 2015 19:55
-
-
Save invisiblek/b4bcb4834ffa9220e63d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/roots.cpp b/roots.cpp | |
index caf015f..4e6fc1d 100644 | |
--- a/roots.cpp | |
+++ b/roots.cpp | |
@@ -232,8 +232,16 @@ fstab_rec* volume_for_path(const char* path) { | |
strcmp(rec->fs_type, "f2fs") == 0 || | |
strcmp(rec->fs_type, "vfat") == 0)) { | |
detected_fs_type = blkid_get_tag_value(NULL, "TYPE", rec->blk_device); | |
- while (rec != NULL && strcmp(rec->fs_type, detected_fs_type) != 0) { | |
- rec = fs_mgr_get_entry_for_mount_point_after(rec, fstab, path); | |
+ if (detected_fs_type != NULL) { | |
+ while (rec != NULL && strcmp(rec->fs_type, detected_fs_type) != 0) { | |
+ rec = fs_mgr_get_entry_for_mount_point_after(rec, fstab, path); | |
+ } | |
+ if (rec == NULL) { | |
+ /* We didn't find a better candidate, use old behavior | |
+ * and pick the first response from fs_mgr. | |
+ */ | |
+ rec = fs_mgr_get_entry_for_mount_point(fstab, path); | |
+ } | |
} | |
} | |
return rec; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment