From 861c2f286ff7e68cbe93f7bc8e43b60638f52848 Mon Sep 17 00:00:00 2001 From: dsmith Date: Wed, 20 Jun 2007 18:00:39 +0000 Subject: 2007-06-20 David Smith * buildrun.cxx (compile_pass): Unset environment variables that could interfere with building the kernel module. Fixes PR 4664. * main.cxx (main): Unsets a few standard environment variables for safety. --- buildrun.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index 13aa9da7..2e6d18d7 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -93,6 +93,18 @@ compile_pass (systemtap_session& s) return rc; } + // Before running make, fix up the environment a bit. PATH should + // already be overridden. Clean out a few variables that + // /lib/modules/${KVER}/build/Makefile uses. + rc = unsetenv("ARCH") || unsetenv("KBUILD_EXTMOD") + || unsetenv("CROSS_COMPILE") || unsetenv("KBUILD_IMAGE") + || unsetenv("KCONFIG_CONFIG") || unsetenv("INSTALL_PATH"); + if (rc) + { + const char* e = strerror (errno); + cerr << "unsetenv failed: " << e << endl; + } + // Run make string make_cmd = string("make") + string (" -C \"") + module_dir + string("\""); -- cgit