mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
Settings: check if writing configuration file was successful
Writing to the file stream might fail due to a immutable file or a filesystem error. Check the error indicator for the stream and for fclose() failures.
This commit is contained in:
9
htop.c
9
htop.c
@ -482,8 +482,13 @@ int main(int argc, char** argv) {
|
||||
Platform_done();
|
||||
|
||||
CRT_done();
|
||||
if (settings->changed)
|
||||
Settings_write(settings);
|
||||
|
||||
if (settings->changed) {
|
||||
int r = Settings_write(settings);
|
||||
if (r < 0)
|
||||
fprintf(stderr, "Can not save configuration to %s: %s\n", settings->filename, strerror(-r));
|
||||
}
|
||||
|
||||
Header_delete(header);
|
||||
ProcessList_delete(pl);
|
||||
|
||||
|
Reference in New Issue
Block a user