Update the conditions to ignore uninteresting fstab entries.
Also add a comment about ignore swap areas.
Bug: 310519261
Change-Id: I8cad25810edb58d0847a98cc1b8813f9893c80a6
Test: Presubmit
diff --git a/artd/path_utils.cc b/artd/path_utils.cc
index 3ebfd81..0972775 100644
--- a/artd/path_utils.cc
+++ b/artd/path_utils.cc
@@ -293,7 +293,11 @@
}
std::vector<FstabEntry> entries;
for (FstabEntry& entry : fstab) {
- if (entry.fs_type == "swap") {
+ // Ignore swap areas as a swap area doesn't have a meaningful `mount_point` (a.k.a., `fs_file`)
+ // field, according to fstab(5). In addition, ignore any other entries whose mount points are
+ // not absolute paths, just in case there are other fs types that also have an meaningless mount
+ // point.
+ if (entry.fs_type == "swap" || !StartsWith(entry.mount_point, '/')) {
continue;
}
if (PathStartsWith(path, entry.mount_point)) {