summaryrefslogtreecommitdiffstats
path: root/Settings.h
diff options
context:
space:
mode:
authorExplorer09 <explorer09@gmail.com>2024-04-17 06:00:44 +0800
committerExplorer09 <explorer09@gmail.com>2024-04-17 06:00:44 +0800
commit752659fd081ec89470cc25d99de9cb06f8025855 (patch)
tree593c60de6723b9be9a9f302b246986858a60b2f8 /Settings.h
parenteaeeda64c12ee7d16bfbb591a0ca2d1a4809ebb7 (diff)
Avoid writing configuration to non-regular files
Check whether the configuration file (after symlink resolution) is writable and is a regular file on htop startup, and only then, write the configuration on exit. Also permit reading when the legacy configuration file ("~/.htoprc") is a symlink. Write the new configuration only when both the legacy file and the new location are writable. Thanks to Christian Göttsche (@cgzones) for providing the initial version of the patch. Fixes: #1426 Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Diffstat (limited to 'Settings.h')
-rw-r--r--Settings.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/Settings.h b/Settings.h
index de4e0096..b5bc8efd 100644
--- a/Settings.h
+++ b/Settings.h
@@ -55,6 +55,7 @@ typedef struct ScreenSettings_ {
typedef struct Settings_ {
char* filename;
char* initialFilename;
+ bool writeConfig; /* whether to write the current settings on exit */
int config_version;
HeaderLayout hLayout;
MeterColumnSetting* hColumns;

© 2014-2024 Faster IT GmbH | imprint | privacy policy