File lbreakouthd-user-hiscoredir.patch of Package lbreakouthd
commit 70e5094212b112ce63399a3beda0e1cbffa0e9b3
Author: Atri Bhattacharya <badshah400@gmail.com>
Date: Thu Jan 19 13:38:48 2023 +0530
Save high scores to user config dir.
Previously high scores were being saved to a common (i.e. not specific
to each user account) file in localstatedir, which needed to be
world-writable to allow any user to save data. This patch uses the user
specific config dir to store the high score file instead, thus avoiding
creating global world-writable files with obvious security implications.
An added benefit of doing this is that one user's hiscores will not be
over-written by another's.
diff --git a/src/hiscores.cpp b/src/hiscores.cpp
index 3938181..110d05a 100644
--- a/src/hiscores.cpp
+++ b/src/hiscores.cpp
@@ -100,7 +100,7 @@ Hiscores::Hiscores()
int l, s;
string prefix;
- fname = string(HISCOREDIR) + "/lbreakouthd.hscr";
+ fname = getHomeDir() + "/" + CONFIGDIR + "/lbreakouthd.hscr";
if (!fileExists(fname)) {
_loginfo("No hiscores file yet.\n");
return; /* no hiscores yet */