Fixed a segfault caused by an unprotected call to getenv()
This commit is contained in:
parent
060f0b6268
commit
0b9d912239
1 changed files with 9 additions and 4 deletions
|
|
@ -61,14 +61,19 @@ namespace ctml {
|
|||
static string pypath() {
|
||||
string s = "python";
|
||||
const char* py = getenv("PYTHON_CMD");
|
||||
|
||||
// Try to source the "setup_cantera" script from the user's home
|
||||
// directory in order to set PYTHON_CMD.
|
||||
if (!py) {
|
||||
const char* hm = getenv("HOME");
|
||||
string home = stripws(string(hm));
|
||||
string cmd = string(". ")+home
|
||||
+string("/setup_cantera &> /dev/null");
|
||||
if (hm) {
|
||||
string home = stripws(string(hm));
|
||||
string cmd = string(". ") + home
|
||||
+string("/setup_cantera &> /dev/null");
|
||||
system(cmd.c_str());
|
||||
}
|
||||
py = getenv("PYTHON_CMD");
|
||||
}
|
||||
}
|
||||
if (py) {
|
||||
string sp = stripws(string(py));
|
||||
if (sp.size() > 0) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue