[mousetweaks] Use xdg runtime dir for pid file. Fixes bgo #675447.
- From: Gerd Kohlberger <gerdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mousetweaks] Use xdg runtime dir for pid file. Fixes bgo #675447.
- Date: Thu, 10 May 2012 13:29:23 +0000 (UTC)
commit db94513c10c2ca307a0e66464271f87b00ddd312
Author: Gerd Kohlberger <gerdk src gnome org>
Date: Thu May 10 15:24:05 2012 +0200
Use xdg runtime dir for pid file. Fixes bgo #675447.
man/mousetweaks.1 | 7 ++++---
src/mt-pidfile.c | 11 ++++++++++-
2 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/man/mousetweaks.1 b/man/mousetweaks.1
index 96914d4..32a1125 100644
--- a/man/mousetweaks.1
+++ b/man/mousetweaks.1
@@ -57,10 +57,11 @@ Start mousetweaks in the background, ie. spawn a child process.
Start mousetweaks in login mode. Login mode enables workarounds specific
to GDM. Currently unused.
.SH FILES
-.I ~/.mousetweaks.pid
+.I mousetweaks.pid
.RS
-The daemon creates a lock file in the users home directory to keep track
-of its status.
+The daemon creates a lock file in the $XDG_RUNTIME_DIR directory to keep track
+of its state. On systems with no user runtime directory, the $XDG_CACHE_HOME
+directory is used.
.SH BUGS
Report bugs to
.UR http://bugzilla.gnome.org/
diff --git a/src/mt-pidfile.c b/src/mt-pidfile.c
index cac3180..d02170a 100644
--- a/src/mt-pidfile.c
+++ b/src/mt-pidfile.c
@@ -48,8 +48,17 @@ static const char *
mt_pidfile_proc (void)
{
static char fn[512];
+ static int fn_set = 0;
+
+ if (!fn_set)
+ {
+ snprintf (fn, sizeof (fn),
+ "%s%smousetweaks.pid",
+ g_get_user_runtime_dir (),
+ G_DIR_SEPARATOR_S);
+ fn_set = 1;
+ }
- snprintf (fn, sizeof (fn), "%s/.mousetweaks.pid", g_get_home_dir ());
return fn;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]