As a safety fallback allow the modifications of the library path to be
suppressed.

Signed-off-by: Andy Whitcroft <[EMAIL PROTECTED]>
---
 hugectl.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/hugectl.c b/hugectl.c
index 26f0389..6742637 100644
--- a/hugectl.c
+++ b/hugectl.c
@@ -70,6 +70,7 @@ void print_usage()
 
        OPTION("--dry-run", "describe what would be done without doing it");
 
+       OPTION("--library-use-path", "Use the system library path");
        OPTION("--library-path <path>", "Select a library prefix");
        CONT("(Default: "
 #ifdef LIBDIR32
@@ -116,6 +117,7 @@ void setup_environment(char *var, char *val)
 
 #define LONG_DRY_RUN   (LONG_BASE | 'd')
 
+#define LONG_NO_LIBRARY        (LONG_BASE | 'L')
 #define LONG_LIBRARY   (LONG_BASE | 'l')
 
 /*
@@ -161,6 +163,8 @@ void setup_mappings(int which)
                setup_environment("HUGETLB_MORECORE", "yes");
 }
 
+#define LIBRARY_DISABLE ((void *)-1)
+
 void library_path(char *path)
 {
        char val[NAME_MAX] = "";
@@ -239,6 +243,8 @@ int main(int argc, char** argv)
                {"dry-run",    no_argument, NULL, LONG_DRY_RUN},
                {"library-path",
                               required_argument, NULL, LONG_LIBRARY},
+               {"library-use-path",
+                              no_argument, NULL, LONG_NO_LIBRARY},
 
                {"disable",    no_argument, NULL, MAP_BASE|MAP_DISABLE},
                {"text",       no_argument, NULL, MAP_BASE|MAP_TEXT},
@@ -275,6 +281,11 @@ int main(int argc, char** argv)
                        opt_dry_run = 1;
                        break;
 
+               case LONG_NO_LIBRARY:
+                       opt_library = LIBRARY_DISABLE;
+                       DEBUG("using LD_LIBRARY_PATH to find library\n");
+                       break;
+
                case LONG_LIBRARY:
                        opt_library = optarg;
                        break;
@@ -293,7 +304,8 @@ int main(int argc, char** argv)
                exit(EXIT_FAILURE);
        }
 
-       library_path(opt_library);
+       if (opt_library != LIBRARY_DISABLE)
+               library_path(opt_library);
 
        if (opt_mappings)
                setup_mappings(opt_mappings);
-- 
1.5.6.GIT


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libhugetlbfs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to