aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2010-10-13 13:48:29 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2010-10-13 13:48:29 (GMT)
commite2d52a39485d0ab9d5cb5ae027372b612eb32e60 (patch)
tree33c8b91d353c4ccc97ee3c2d9ec5198bcb5aab25 /src
parent650b6f842ba5e996e1159ca78b9bafea9ab58b3c (diff)
downloadfluxbox_paul-e2d52a39485d0ab9d5cb5ae027372b612eb32e60.zip
fluxbox_paul-e2d52a39485d0ab9d5cb5ae027372b612eb32e60.tar.bz2
bugfix: std::string() does not like NULL on construction
not having DISPLAY set (eg: on a headless system) caused fluxbox to crash.
Diffstat (limited to 'src')
-rw-r--r--src/main.cc25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/main.cc b/src/main.cc
index b678738..4b4bdc5 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -216,14 +216,23 @@ static void showInfo(ostream &ostr) {
216} 216}
217 217
218struct Options { 218struct Options {
219 Options() : 219 Options() : xsync(false) {
220 session_display(getenv("DISPLAY")),
221 rc_path(std::string(getenv("HOME")) + "/." + realProgramName("fluxbox")),
222 rc_file(rc_path + "/init"),
223 xsync(false) {
224 220
221 const char* env;
222
223 env = getenv("DISPLAY");
224 if (env) {
225 session_display.assign(env);
226 }
227
228 env = getenv("HOME");
229 if (env) {
230 rc_path.assign(std::string(env) + "/." + realProgramName("fluxbox"));
231 rc_file = rc_path + "/init";
232 }
225 } 233 }
226 234
235
227 std::string session_display; 236 std::string session_display;
228 std::string rc_path; 237 std::string rc_path;
229 std::string rc_file; 238 std::string rc_file;
@@ -394,7 +403,11 @@ void updateConfigFilesIfNeeded(const std::string& rc_file) {
394 string commandargs = realProgramName("fluxbox-update_configs"); 403 string commandargs = realProgramName("fluxbox-update_configs");
395 commandargs += " -rc " + rc_file; 404 commandargs += " -rc " + rc_file;
396 405
397 system(commandargs.c_str()); 406 if (system(commandargs.c_str())) {
407 fbdbg << "running '"
408 << commandargs
409 << "' failed." << endl;
410 }
398 } 411 }
399} 412}
400 413