bugfix: std::string() does not like NULL on construction
not having DISPLAY set (eg: on a headless system) caused fluxbox to crash.
This commit is contained in:
parent
650b6f842b
commit
e2d52a3948
1 changed files with 19 additions and 6 deletions
25
src/main.cc
25
src/main.cc
|
@ -216,14 +216,23 @@ static void showInfo(ostream &ostr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Options {
|
struct Options {
|
||||||
Options() :
|
Options() : xsync(false) {
|
||||||
session_display(getenv("DISPLAY")),
|
|
||||||
rc_path(std::string(getenv("HOME")) + "/." + realProgramName("fluxbox")),
|
|
||||||
rc_file(rc_path + "/init"),
|
|
||||||
xsync(false) {
|
|
||||||
|
|
||||||
|
const char* env;
|
||||||
|
|
||||||
|
env = getenv("DISPLAY");
|
||||||
|
if (env) {
|
||||||
|
session_display.assign(env);
|
||||||
|
}
|
||||||
|
|
||||||
|
env = getenv("HOME");
|
||||||
|
if (env) {
|
||||||
|
rc_path.assign(std::string(env) + "/." + realProgramName("fluxbox"));
|
||||||
|
rc_file = rc_path + "/init";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string session_display;
|
std::string session_display;
|
||||||
std::string rc_path;
|
std::string rc_path;
|
||||||
std::string rc_file;
|
std::string rc_file;
|
||||||
|
@ -394,7 +403,11 @@ void updateConfigFilesIfNeeded(const std::string& rc_file) {
|
||||||
string commandargs = realProgramName("fluxbox-update_configs");
|
string commandargs = realProgramName("fluxbox-update_configs");
|
||||||
commandargs += " -rc " + rc_file;
|
commandargs += " -rc " + rc_file;
|
||||||
|
|
||||||
system(commandargs.c_str());
|
if (system(commandargs.c_str())) {
|
||||||
|
fbdbg << "running '"
|
||||||
|
<< commandargs
|
||||||
|
<< "' failed." << endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue