mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
tests: avoid crash when run under gcov
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().
This commit is contained in:
parent
ba13a37cff
commit
70ea7decbe
@ -748,6 +748,18 @@ cleanup:
|
||||
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)
|
||||
{
|
||||
@ -771,17 +783,6 @@ 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) \
|
||||
|
Loading…
x
Reference in New Issue
Block a user