diff --git a/utils.c b/utils.c index 5b983375..c360445a 100644 --- a/utils.c +++ b/utils.c @@ -2078,7 +2078,8 @@ int find_mount_root(const char *path, char **mount_root) while ((ent = getmntent(mnttab))) { len = strlen(ent->mnt_dir); - if (strncmp(ent->mnt_dir, path, len) == 0) { + if (strncmp(ent->mnt_dir, path, len) == 0 && + (path[len] == '/' || path[len] == '\0')) { /* match found and use the latest match */ if (longest_matchlen <= len) { free(longest_match);