]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Sanity check VG_LIBDIR (the --libdir= config value) at startup to detect
authorJulian Seward <jseward@acm.org>
Mon, 3 Jun 2002 01:10:40 +0000 (01:10 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 3 Jun 2002 01:10:40 +0000 (01:10 +0000)
cases which will later cause fork/exec to fail.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@362

coregrind/vg_main.c
vg_main.c

index 9f50ab21bd4e89bad42f0b9051dd524ce9e7652b..8784499d5d34b2f64101ed50ce74f1675d7919c6 100644 (file)
@@ -466,8 +466,10 @@ static void config_error ( Char* msg )
 {
    VG_(shutdown_logging)();
    VG_(clo_logfile_fd) = 2; /* stderr */
-   VG_(printf)("valgrind.so: Startup or configuration error:\n\t%s\n", msg);
-   VG_(printf)("valgrind.so: Unable to start up properly.  Giving up.\n");
+   VG_(printf)(
+      "valgrind.so: Startup or configuration error:\n   %s\n", msg);
+   VG_(printf)(
+      "valgrind.so: Unable to start up properly.  Giving up.\n");
    VG_(exit)(1);
 }
 
@@ -531,6 +533,11 @@ static void process_cmd_line_options ( void )
       to failures in initialisation. */
    VG_(startup_logging)();
 
+   /* Check for sane path in ./configure --prefix=... */
+   if (VG_(strlen)(VG_LIBDIR) < 1 
+       || VG_LIBDIR[0] != '/') 
+     config_error("Please use absolute paths in "
+                  "./configure --prefix=... or --libdir=...");
 
    /* (Suggested by Fabrice Bellard ... )
       We look for the Linux ELF table and go down until we find the
@@ -1231,7 +1238,9 @@ void VG_(mash_LD_PRELOAD_and_LD_LIBRARY_PATH) ( Char* ld_preload_str,
       "   p_prel              = `%s'\n"
       "   p_path              = `%s'\n"
       "   VG_LIBDIR           = `%s'\n",
-       what, ld_preload_str, ld_library_path_str, p_prel, p_path, VG_LIBDIR );
+      what, ld_preload_str, ld_library_path_str, 
+      p_prel, p_path, VG_LIBDIR 
+   );
    VG_(panic)("VG_(mash_LD_PRELOAD_and_LD_LIBRARY_PATH) failed\n");
 }
 
index 9f50ab21bd4e89bad42f0b9051dd524ce9e7652b..8784499d5d34b2f64101ed50ce74f1675d7919c6 100644 (file)
--- a/vg_main.c
+++ b/vg_main.c
@@ -466,8 +466,10 @@ static void config_error ( Char* msg )
 {
    VG_(shutdown_logging)();
    VG_(clo_logfile_fd) = 2; /* stderr */
-   VG_(printf)("valgrind.so: Startup or configuration error:\n\t%s\n", msg);
-   VG_(printf)("valgrind.so: Unable to start up properly.  Giving up.\n");
+   VG_(printf)(
+      "valgrind.so: Startup or configuration error:\n   %s\n", msg);
+   VG_(printf)(
+      "valgrind.so: Unable to start up properly.  Giving up.\n");
    VG_(exit)(1);
 }
 
@@ -531,6 +533,11 @@ static void process_cmd_line_options ( void )
       to failures in initialisation. */
    VG_(startup_logging)();
 
+   /* Check for sane path in ./configure --prefix=... */
+   if (VG_(strlen)(VG_LIBDIR) < 1 
+       || VG_LIBDIR[0] != '/') 
+     config_error("Please use absolute paths in "
+                  "./configure --prefix=... or --libdir=...");
 
    /* (Suggested by Fabrice Bellard ... )
       We look for the Linux ELF table and go down until we find the
@@ -1231,7 +1238,9 @@ void VG_(mash_LD_PRELOAD_and_LD_LIBRARY_PATH) ( Char* ld_preload_str,
       "   p_prel              = `%s'\n"
       "   p_path              = `%s'\n"
       "   VG_LIBDIR           = `%s'\n",
-       what, ld_preload_str, ld_library_path_str, p_prel, p_path, VG_LIBDIR );
+      what, ld_preload_str, ld_library_path_str, 
+      p_prel, p_path, VG_LIBDIR 
+   );
    VG_(panic)("VG_(mash_LD_PRELOAD_and_LD_LIBRARY_PATH) failed\n");
 }