summaryrefslogtreecommitdiff
path: root/config.h
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2001-01-13 15:36:31 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2001-01-13 15:36:31 +0100
commit297e727a59b2e08f8c414739325f8df390b567c4 (patch)
tree0eb697cc5be0968b3fbcc7151f87e2fc5b8ac647 /config.h
parentba2c25d1835dae0030b12e35b814c2b0ab9406fb (diff)
downloadvdr-297e727a59b2e08f8c414739325f8df390b567c4.tar.gz
vdr-297e727a59b2e08f8c414739325f8df390b567c4.tar.bz2
Implemented safe writing of config files
Diffstat (limited to 'config.h')
-rw-r--r--config.h13
1 files changed, 5 insertions, 8 deletions
diff --git a/config.h b/config.h
index 34e20182..8f3cc77a 100644
--- a/config.h
+++ b/config.h
@@ -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;
}
};