summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormetalefty <meta@vmeta.jp>2016-11-07 09:56:31 +0900
committerGitHub <noreply@github.com>2016-11-07 09:56:31 +0900
commit94901c998942ae80654eb509227bece5bfdd2fb6 (patch)
treecd002483232718f8d543fe8a8f5cd2e53a09aa92
parent7c516d7d07cd0a136666d641cb756b5dfc53bcc7 (diff)
parent2016065a407bf59eae86e7e399b468a6017e2420 (diff)
downloadxrdp-proprietary-94901c998942ae80654eb509227bece5bfdd2fb6.tar.gz
xrdp-proprietary-94901c998942ae80654eb509227bece5bfdd2fb6.zip
Merge pull request #454 from metalefty/change-chansrv-log-path
chansrv: change chansrv log path to ${XDG_DATA_HOME}/xrdp
-rw-r--r--docs/man/xrdp-chansrv.82
-rw-r--r--sesman/chansrv/chansrv.c40
2 files changed, 41 insertions, 1 deletions
diff --git a/docs/man/xrdp-chansrv.8 b/docs/man/xrdp-chansrv.8
index aa4747d8..33d16c06 100644
--- a/docs/man/xrdp-chansrv.8
+++ b/docs/man/xrdp-chansrv.8
@@ -36,7 +36,7 @@ UNIX socket used by external programs to implement channels.
.I /tmp/.xrdp/xrdp_api_*
UNIX socket used by \fBxrdp\-chansrv\fP to communicate with \fBxrdp\-sesman\fP.
.TP
-.I $HOME/xrdp-chansrv.log
+.I $XDG_DATA_HOME/xrdp/xrdp-chansrv.log
Log file used by \fBxrdp\-chansrv\fP(8).
.SH "SEE ALSO"
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;
}