diff options
author | Koichiro IWAO <meta@vmeta.jp> | 2016-10-25 14:52:43 +0900 |
---|---|---|
committer | Koichiro IWAO <meta@vmeta.jp> | 2016-10-25 14:52:43 +0900 |
commit | 7d017482f649103374b15bb31c760c7e2e9d583e (patch) | |
tree | e6f9952f75c226e71cbfb0752be1156fffcc86d4 | |
parent | 34378ea386134f017da62bf0c06916506379f92b (diff) | |
download | xrdp-proprietary-7d017482f649103374b15bb31c760c7e2e9d583e.tar.gz xrdp-proprietary-7d017482f649103374b15bb31c760c7e2e9d583e.zip |
chansrv: change chansrv log path to ${XDG_DATA_HOME}/xrdp
like Xorg's logfile is written to ${XDG_DATA_HOME}/xorg/Xorg.n.log.
If XDG_DATA_HOME is not defined, the log path will be
${HOME}/.local/share/xrdp.
-rw-r--r-- | sesman/chansrv/chansrv.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/sesman/chansrv/chansrv.c b/sesman/chansrv/chansrv.c index d272806c..89040377 100644 --- a/sesman/chansrv/chansrv.c +++ b/sesman/chansrv/chansrv.c @@ -1391,12 +1391,52 @@ static char* APP_CC get_log_path() { char* log_path = 0; + char* cp = 0; log_path = g_getenv("CHANSRV_LOG_PATH"); + + if (log_path == 0) + { + log_path = g_getenv("XDG_DATA_HOME"); + if (log_path != 0) + { + cp = malloc(strlen(log_path) + strlen("/xrdp") + 1); + + if (cp != 0) + { + memcpy(cp, log_path, strlen(log_path)); + memcpy(cp + strlen(log_path), "/xrdp", strlen("/xrdp") + 1); + if (g_directory_exist(cp) || g_mkdir(cp)) + { + log_path = cp; + } + else + { + free(cp); + } + } + } + } + if (log_path == 0) { log_path = g_getenv("HOME"); + if (log_path != 0) + { + cp = malloc(strlen(log_path) + strlen("/.local/share/xrdp") + 1); + + if (cp != 0) + { + memcpy(cp, log_path, strlen(log_path)); + memcpy(cp + strlen(log_path), "/.local/share/xrdp", strlen("/.local/share/xrdp") + 1); + if (g_directory_exist(cp) || g_mkdir(cp)) + log_path = cp; + else + free(cp); + } + } } + return log_path; } |