Merge "fs_mgr_fstab: do an exact match when searching a mount point" am: a0dd1adab0 am: dff1e3418e
am: d4ce377d8c
Change-Id: I39df04346c5d45ebd8689c25bd2a3244b185fc90
This commit is contained in:
commit
c4decb0f7e
1 changed files with 8 additions and 7 deletions
|
|
@ -791,11 +791,12 @@ int fs_mgr_add_entry(struct fstab *fstab,
|
||||||
* Returns the 1st matching fstab_rec that follows the start_rec.
|
* Returns the 1st matching fstab_rec that follows the start_rec.
|
||||||
* start_rec is the result of a previous search or NULL.
|
* start_rec is the result of a previous search or NULL.
|
||||||
*/
|
*/
|
||||||
struct fstab_rec *fs_mgr_get_entry_for_mount_point_after(struct fstab_rec *start_rec, struct fstab *fstab, const char *path)
|
struct fstab_rec* fs_mgr_get_entry_for_mount_point_after(struct fstab_rec* start_rec,
|
||||||
{
|
struct fstab* fstab,
|
||||||
|
const std::string& path) {
|
||||||
int i;
|
int i;
|
||||||
if (!fstab) {
|
if (!fstab) {
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (start_rec) {
|
if (start_rec) {
|
||||||
|
|
@ -808,14 +809,14 @@ struct fstab_rec *fs_mgr_get_entry_for_mount_point_after(struct fstab_rec *start
|
||||||
} else {
|
} else {
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; i < fstab->num_entries; i++) {
|
for (; i < fstab->num_entries; i++) {
|
||||||
int len = strlen(fstab->recs[i].mount_point);
|
if (fstab->recs[i].mount_point && path == fstab->recs[i].mount_point) {
|
||||||
if (strncmp(path, fstab->recs[i].mount_point, len) == 0 &&
|
|
||||||
(path[len] == '\0' || path[len] == '/')) {
|
|
||||||
return &fstab->recs[i];
|
return &fstab->recs[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue