From: Julian Seward Date: Mon, 3 Jun 2002 01:10:40 +0000 (+0000) Subject: Sanity check VG_LIBDIR (the --libdir= config value) at startup to detect X-Git-Tag: svn/VALGRIND_1_0_3~109 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ff2f8bf01caa16178ebeb542aa94eeaf1a94c6b;p=thirdparty%2Fvalgrind.git Sanity check VG_LIBDIR (the --libdir= config value) at startup to detect cases which will later cause fork/exec to fail. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@362 --- diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c index 9f50ab21bd..8784499d5d 100644 --- a/coregrind/vg_main.c +++ b/coregrind/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"); } diff --git a/vg_main.c b/vg_main.c index 9f50ab21bd..8784499d5d 100644 --- 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"); }