string histfile;
try {
- Pathname p (getenv ("HOME"));
- p /= ".zypper_history";
- histfile = p.asString ();
+ const char * env = getenv ("HOME");
+ if ( env )
+ {
+ Pathname p( env );
+ p /= ".zypper_history";
+ histfile = p.asString ();
+ }
} catch (...) {
// no history
}
want_custom = true;
if (filepath.relative())
{
- string wd = ::getenv("PWD");
+ const char * env = ::getenv("PWD");
+ string wd = env ? env : ".";
filepath = wd / filepath;
}
}
else
{
- _homedir = ::getenv("HOME");
+ const char * env = ::getenv("HOME");
+ if ( env )
+ _homedir = env;
if (_homedir.empty())
WAR << "Cannot figure out user's home directory. Skipping user's config." << endl;
else