diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2001-01-13 15:36:31 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2001-01-13 15:36:31 +0100 |
commit | 297e727a59b2e08f8c414739325f8df390b567c4 (patch) | |
tree | 0eb697cc5be0968b3fbcc7151f87e2fc5b8ac647 /config.h | |
parent | ba2c25d1835dae0030b12e35b814c2b0ab9406fb (diff) | |
download | vdr-297e727a59b2e08f8c414739325f8df390b567c4.tar.gz vdr-297e727a59b2e08f8c414739325f8df390b567c4.tar.bz2 |
Implemented safe writing of config files
Diffstat (limited to 'config.h')
-rw-r--r-- | config.h | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 1.36 2000/12/25 14:20:09 kls Exp $ + * $Id: config.h 1.37 2001/01/13 14:56:29 kls Exp $ */ #ifndef __CONFIG_H @@ -202,11 +202,10 @@ public: } bool Save(void) { - //TODO make backup copies??? bool result = true; T *l = (T *)First(); - FILE *f = fopen(fileName, "w"); - if (f) { + cSafeFile f(fileName); + if (f.Open()) { while (l) { if (!l->Save(f)) { result = false; @@ -214,12 +213,10 @@ public: } l = (T *)l->Next(); } - fclose(f); + f.Close(); } - else { - LOG_ERROR_STR(fileName); + else result = false; - } return result; } }; |