mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
Implemented safe writing of config files
This commit is contained in:
16
tools.h
16
tools.h
@@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: tools.h 1.22 2000/12/10 11:49:42 kls Exp $
|
||||
* $Id: tools.h 1.23 2001/01/13 15:36:00 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __TOOLS_H
|
||||
@@ -48,6 +48,7 @@ uint FreeDiskSpaceMB(const char *Directory);
|
||||
bool DirectoryOk(const char *DirName, bool LogErrors = false);
|
||||
bool MakeDirs(const char *FileName, bool IsDirectory = false);
|
||||
bool RemoveFileOrDir(const char *FileName, bool FollowSymlinks = false);
|
||||
char *ReadLink(const char *FileName);
|
||||
|
||||
class cFile {
|
||||
private:
|
||||
@@ -68,6 +69,19 @@ public:
|
||||
static bool FileReady(int FileDes, int TimeoutMs = 1000);
|
||||
};
|
||||
|
||||
class cSafeFile {
|
||||
private:
|
||||
FILE *f;
|
||||
char *fileName;
|
||||
char *tempName;
|
||||
public:
|
||||
cSafeFile(const char *FileName);
|
||||
~cSafeFile();
|
||||
operator FILE* () { return f; }
|
||||
bool Open(void);
|
||||
void Close(void);
|
||||
};
|
||||
|
||||
class cListObject {
|
||||
private:
|
||||
cListObject *prev, *next;
|
||||
|
||||
Reference in New Issue
Block a user