String comparison in hugetlb_setup_env is done in an inconsisten way.  This
is a problem because some of the environment variables are checked ignoring
case where others are case sensitive.  This patch converts all of the
comparisons looking for boolean (yes/no) values to ignore case.

Signed-off-by: Eric B Munson <emun...@mgebm.net>
---
Changes from V1:
 Because getenv depends on NULL terminated strings, using strncasecmp doesn't
buy us anything and it introduces the problem of yes matching yesterday

 hugeutils.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hugeutils.c b/hugeutils.c
index 70e3d22..b28bd0a 100644
--- a/hugeutils.c
+++ b/hugeutils.c
@@ -371,12 +371,12 @@ void hugetlbfs_setup_env()
 
        /* Determine if shmget() calls should be overridden */
        env = getenv("HUGETLB_SHM");
-       if (env && !strcmp(env, "yes"))
+       if (env && !strcasecmp(env, "yes"))
                __hugetlb_opts.shm_enabled = true;
 
        /* Determine if all reservations should be avoided */
        env = getenv("HUGETLB_NO_RESERVE");
-       if (env && !strcmp(env, "yes"))
+       if (env && !strcasecmp(env, "yes"))
                __hugetlb_opts.no_reserve = true;
 }
 
-- 
1.7.4.1


------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to