Do not store getenv() pointers in static variables.
... or the pointer might be invalidated if the environments changes. Fixes #63. * src/taalgos/dotty.cc, src/tgbaalgos/dotty.cc, src/tgbaalgos/dtbasat.cc, src/tgbaalgos/dtgbasat.cc: Copy the environment in strings instead. * wrap/python/tests/automata.ipynb: Adjust comment.
This commit is contained in:
parent
519f5e3cee
commit
125fa983ab
5 changed files with 71 additions and 31 deletions
|
|
@ -906,8 +906,15 @@ namespace spot
|
|||
if (!solution.second.empty())
|
||||
res = sat_build(solution.second, d, a, state_based);
|
||||
|
||||
static const char* log = getenv("SPOT_SATLOG");
|
||||
if (log)
|
||||
// Always copy the environment variable into a static string,
|
||||
// so that we (1) look it up once, but (2) won't crash if the
|
||||
// environment is changed.
|
||||
static std::string log = []()
|
||||
{
|
||||
auto s = getenv("SPOT_SATLOG");
|
||||
return s ? s : "";
|
||||
}();
|
||||
if (!log.empty())
|
||||
{
|
||||
std::fstream out(log,
|
||||
std::ios_base::app | std::ios_base::out);
|
||||
|
|
@ -930,7 +937,7 @@ namespace spot
|
|||
<< te.utime() << ',' << te.stime() << ','
|
||||
<< ts.utime() << ',' << ts.stime() << '\n';
|
||||
}
|
||||
static const char* show = getenv("SPOT_SATSHOW");
|
||||
static bool show = getenv("SPOT_SATSHOW");
|
||||
if (show && res)
|
||||
dotty_reachable(std::cout, res);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue