diff options
author | Benny Baumann <BenBE@geshi.org> | 2021-02-16 19:44:59 +0100 |
---|---|---|
committer | Benny Baumann <BenBE@geshi.org> | 2021-02-17 15:59:50 +0100 |
commit | 82157f598e09790b408a4e519a25d3affba95240 (patch) | |
tree | 77f86dbd0a50bb2e4017a0fe308e9967adf91279 /Settings.c | |
parent | a73064dda97d751047748c4539a969495bdadf73 (diff) |
Refactor to remove no-op calls
This removes the call-sites of the removed setuid feature
Diffstat (limited to 'Settings.c')
-rw-r--r-- | Settings.c | 18 |
1 files changed, 4 insertions, 14 deletions
@@ -125,10 +125,7 @@ static void readFields(ProcessField* fields, uint32_t* flags, const char* line) } static bool Settings_read(Settings* this, const char* fileName, int initialCpuCount) { - FILE* fd; - CRT_dropPrivileges(); - fd = fopen(fileName, "r"); - CRT_restorePrivileges(); + FILE* fd = fopen(fileName, "r"); if (!fd) return false; @@ -284,15 +281,10 @@ static void writeMeterModes(Settings* this, FILE* fd, int column) { } bool Settings_write(Settings* this) { - FILE* fd; - - CRT_dropPrivileges(); - fd = fopen(this->filename, "w"); - CRT_restorePrivileges(); - - if (fd == NULL) { + FILE* fd = fopen(this->filename, "w"); + if (fd == NULL) return false; - } + fprintf(fd, "# Beware! This file is rewritten by htop when settings are changed in the interface.\n"); fprintf(fd, "# The parser is also very primitive, and not human-friendly.\n"); writeFields(fd, this->fields, "fields"); @@ -410,7 +402,6 @@ Settings* Settings_new(int initialCpuCount) { htopDir = String_cat(home, "/.config/htop"); } legacyDotfile = String_cat(home, "/.htoprc"); - CRT_dropPrivileges(); (void) mkdir(configDir, 0700); (void) mkdir(htopDir, 0700); free(htopDir); @@ -421,7 +412,6 @@ Settings* Settings_new(int initialCpuCount) { free(legacyDotfile); legacyDotfile = NULL; } - CRT_restorePrivileges(); } this->colorScheme = 0; this->enableMouse = true; |