diff options
author | Daniel Lange <DLange@git.local> | 2016-07-25 18:25:28 +0200 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2016-07-25 18:25:28 +0200 |
commit | 31b71b67011fa52f091df6fe536a11d6d0bfb256 (patch) | |
tree | 31cb222871017376af8b7435d24cf4961863fa93 /Settings.c | |
parent | 8c82a38002ce09db2a0b83dab8b598cf1ab0596c (diff) | |
download | debian_htop-31b71b67011fa52f091df6fe536a11d6d0bfb256.tar.gz debian_htop-31b71b67011fa52f091df6fe536a11d6d0bfb256.tar.bz2 debian_htop-31b71b67011fa52f091df6fe536a11d6d0bfb256.zip |
Imported Upstream version 2.0.2upstream/2.0.2
Diffstat (limited to 'Settings.c')
-rw-r--r-- | Settings.c | 25 |
1 files changed, 14 insertions, 11 deletions
@@ -159,7 +159,7 @@ static void readFields(ProcessField* fields, int* flags, const char* line) { j++; } } - fields[j] = (ProcessField) NULL; + fields[j] = NULL_PROCESSFIELD; String_freeArray(ids); } @@ -167,18 +167,21 @@ static bool Settings_read(Settings* this, const char* fileName) { FILE* fd; uid_t euid = geteuid(); - seteuid(getuid()); + (void) seteuid(getuid()); fd = fopen(fileName, "r"); - seteuid(euid); + (void) seteuid(euid); if (!fd) return false; - const int maxLine = 2048; - char buffer[maxLine]; bool readMeters = false; - while (fgets(buffer, maxLine, fd)) { + for (;;) { + char* line = String_readLine(fd); + if (!line) { + break; + } int nOptions; - char** option = String_split(buffer, '=', &nOptions); + char** option = String_split(line, '=', &nOptions); + free (line); if (nOptions < 2) { String_freeArray(option); continue; @@ -277,9 +280,9 @@ bool Settings_write(Settings* this) { FILE* fd; uid_t euid = geteuid(); - seteuid(getuid()); + (void) seteuid(getuid()); fd = fopen(this->filename, "w"); - seteuid(euid); + (void) seteuid(euid); if (fd == NULL) { return false; } @@ -366,7 +369,7 @@ Settings* Settings_new(int cpuCount) { } legacyDotfile = String_cat(home, "/.htoprc"); uid_t euid = geteuid(); - seteuid(getuid()); + (void) seteuid(getuid()); (void) mkdir(configDir, 0700); (void) mkdir(htopDir, 0700); free(htopDir); @@ -379,7 +382,7 @@ Settings* Settings_new(int cpuCount) { free(legacyDotfile); legacyDotfile = NULL; } - seteuid(euid); + (void) seteuid(euid); } this->colorScheme = 0; this->changed = false; |