aboutsummaryrefslogtreecommitdiff
path: root/src/main.cc
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2013-06-29 06:39:02 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2013-06-29 06:39:02 (GMT)
commitf464f24eb3a5872404f60356009f466d5f79f2b1 (patch)
tree285557bd93d1f1825f21ced9766e1bcfeb2f90fc /src/main.cc
parent2efd4b823082efb45cb351c7185d510ccb1dd32a (diff)
downloadfluxbox-f464f24eb3a5872404f60356009f466d5f79f2b1.zip
fluxbox-f464f24eb3a5872404f60356009f466d5f79f2b1.tar.bz2
fix detection of $HOME folder
usually $HOME is set when fluxbox runs. in some rare scenarios (eg., fuzzying binaries to detect bugs) one could launch fluxbox by using 'env -i' and thus eliminating $HOME from the environment. to prevent crashes fluxbox uses now 'getpwuid()' when $HOME is not set to detect the home folder.
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/main.cc b/src/main.cc
index 0639e30..435e9f4 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -239,13 +239,10 @@ struct Options {
239 if (env && strlen(env) > 0) { 239 if (env && strlen(env) > 0) {
240 session_display.assign(env); 240 session_display.assign(env);
241 } 241 }
242#ifdef _WIN32 242
243 env = getenv("USERPROFILE"); 243 rc_path = FbTk::StringUtil::expandFilename(std::string("~/.") + realProgramName("fluxbox"));
244#else 244
245 env = getenv("HOME"); 245 if (!rc_path.empty()) {
246#endif
247 if (env && strlen(env) > 0) {
248 rc_path.assign(std::string(env) + "/." + realProgramName("fluxbox"));
249 rc_file = rc_path + "/init"; 246 rc_file = rc_path + "/init";
250 } 247 }
251 } 248 }