Currently the library will select the first hugetlbfs mount it finds for a given page size for usage. This can lead to frustrating failures when root owns the first mount and a user has a later mount in the list. This patch makes find_mounts check if a given mount is usable by the current user. Mounts that are not usable will be skipped.
Signed-off-by: Eric B Munson <emun...@mgebm.net> Cc: Andrew Lutomirski <l...@mit.edu> Cc: David Gibson <da...@gibson.dropbear.id.au> --- Changes from V1: Use access(2) instead of stat+permission checking hugeutils.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/hugeutils.c b/hugeutils.c index b28bd0a..8bccace 100644 --- a/hugeutils.c +++ b/hugeutils.c @@ -652,7 +652,8 @@ static void find_mounts(void) */ err = sscanf(line, "%*s %" stringify(PATH_MAX) "s hugetlbfs " "%*s %d", path, &dummy); - if ((err == 2) && (hugetlbfs_test_path(path) == 1)) + if ((err == 2) && (hugetlbfs_test_path(path) == 1) && + !(access(path, R_OK | W_OK | X_OK))) add_hugetlbfs_mount(path, 0); } close(fd); -- 1.7.5.4 ------------------------------------------------------------------------------ Learn Windows Azure Live! Tuesday, Dec 13, 2011 Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure _______________________________________________ Libhugetlbfs-devel mailing list Libhugetlbfs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel