summaryrefslogtreecommitdiffstats
path: root/htop.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2021-03-12 16:56:06 +0100
committerChristian Göttsche <cgzones@googlemail.com>2021-03-12 16:56:06 +0100
commit521f1343e372e011326e10cf58a9ba1d191b7bdb (patch)
treeaea050326b3d520f96b6e6a1480c9b21229b50d3 /htop.c
parent350b48e44c45a280520c15762a04940670b6aec9 (diff)
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.
Diffstat (limited to 'htop.c')
-rw-r--r--htop.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/htop.c b/htop.c
index 785d4554..285353d5 100644
--- a/htop.c
+++ b/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);

© 2014-2024 Faster IT GmbH | imprint | privacy policy