Running ./autobuild.sh failed when gcov is installed, because
commandtest ended up crashing during gcov's getenv() call after
exit() had already started. I traced this nasty bug back to
a scoping issue present since the test introduction.
* tests/commandtest.c (mymain): Move newenv...
(newenv): ...to a scope that is still useful during exit().
return ret;
}
+static const char *const newenv[] = {
+ "PATH=/usr/bin:/bin",
+ "HOSTNAME=test",
+ "LANG=C",
+ "HOME=/home/test",
+ "USER=test",
+ "LOGNAME=test"
+ "TMPDIR=/tmp",
+ "DISPLAY=:0.0",
+ NULL
+};
+
static int
mymain(void)
{
virInitialize();
- const char *const newenv[] = {
- "PATH=/usr/bin:/bin",
- "HOSTNAME=test",
- "LANG=C",
- "HOME=/home/test",
- "USER=test",
- "LOGNAME=test"
- "TMPDIR=/tmp",
- "DISPLAY=:0.0",
- NULL
- };
environ = (char **)newenv;
# define DO_TEST(NAME) \