diff options
author | Explorer09 <explorer09@gmail.com> | 2024-04-17 06:00:44 +0800 |
---|---|---|
committer | Explorer09 <explorer09@gmail.com> | 2024-04-17 06:00:44 +0800 |
commit | 752659fd081ec89470cc25d99de9cb06f8025855 (patch) | |
tree | 593c60de6723b9be9a9f302b246986858a60b2f8 /Settings.h | |
parent | eaeeda64c12ee7d16bfbb591a0ca2d1a4809ebb7 (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.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -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; |