From 8eb0c7a26574485ffbf6d30c9a7a801041cbea4b Mon Sep 17 00:00:00 2001 From: Vladis Dronov Date: Wed, 11 Jan 2023 16:34:22 +0100 Subject: [PATCH] Make location of .xsession-errors configurable See: https://github.com/canonical/lightdm/issues/95 --- src/session.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/session.c b/src/session.c index fce12a0b..aaad7e62 100644 --- a/src/session.c +++ b/src/session.c @@ -981,7 +981,14 @@ session_init (Session *session) { SessionPrivate *priv = session_get_instance_private (session); - priv->log_filename = g_strdup (".xsession-errors"); + if (g_getenv ("XDG_STATE_HOME")) + priv->log_filename = g_build_filename (g_getenv ("XDG_STATE_HOME"), ".xsession-errors", NULL); + else + if (g_getenv ("XDG_CACHE_HOME")) + priv->log_filename = g_build_filename (g_getenv ("XDG_STATE_HOME"), ".xsession-errors", NULL); + else + priv->log_filename = g_build_filename (".cache", ".xsession-errors", NULL); + priv->log_mode = LOG_MODE_BACKUP_AND_TRUNCATE; priv->to_child_input = -1; priv->from_child_output = -1;