From f588b2731518e2a5b163d02cdeb3043c7d6fa92d Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Mon, 11 Mar 2024 21:05:37 +0100 Subject: Resolve configuration path Some configuration systems might link a htop configuration file and we don't really want to replace the symlink but rather its source. This will also allow us to fail in case the source is read only. Signed-off-by: Sefa Eyeoglu --- Settings.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Settings.c') diff --git a/Settings.c b/Settings.c index 9f1170e7..c2d3e92f 100644 --- a/Settings.c +++ b/Settings.c @@ -826,6 +826,12 @@ Settings* Settings_new(unsigned int initialCpuCount, Hashtable* dynamicMeters, H legacyDotfile = NULL; } } + + char* resolvedFilename = xMalloc(PATH_MAX); + if (realpath(this->filename, resolvedFilename)) + free_and_xStrdup(&this->filename, resolvedFilename); + free(resolvedFilename); + this->colorScheme = 0; #ifdef HAVE_GETMOUSE this->enableMouse = true; -- cgit v1.2.3