aboutsummaryrefslogtreecommitdiff
path: root/lib/dvb/epgcache.cpp
diff options
context:
space:
mode:
authorAndreas Oberritter <obi@opendreambox.org>2008-09-30 23:09:16 +0000
committerAndreas Oberritter <obi@opendreambox.org>2008-09-30 23:09:16 +0000
commit6c3d8bc02e8f4500c631a6089ad99f44ad8beca1 (patch)
tree99178023c70a561cca90af236cd3eb571d1e4919 /lib/dvb/epgcache.cpp
parent4514d25acd99a7f79890ae62d11ee1adfc36bf58 (diff)
downloadenigma2-6c3d8bc02e8f4500c631a6089ad99f44ad8beca1.tar.gz
enigma2-6c3d8bc02e8f4500c631a6089ad99f44ad8beca1.zip
fix corrupted epg.dat by using a faked version string and not writing the correct version string until all epg data has been flushed to disk
Diffstat (limited to 'lib/dvb/epgcache.cpp')
-rw-r--r--lib/dvb/epgcache.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/dvb/epgcache.cpp b/lib/dvb/epgcache.cpp
index 2a070473..1a07755f 100644
--- a/lib/dvb/epgcache.cpp
+++ b/lib/dvb/epgcache.cpp
@@ -1018,7 +1018,7 @@ void eEPGCache::save()
{
unsigned int magic = 0x98765432;
fwrite( &magic, sizeof(int), 1, f);
- const char *text = "ENIGMA_EPG_V7";
+ const char *text = "UNFINISHED_V7";
fwrite( text, 13, 1, f );
int size = eventDB.size();
fwrite( &size, sizeof(int), 1, f );
@@ -1065,6 +1065,11 @@ void eEPGCache::save()
}
}
#endif
+ // write version string after binary data
+ // has been written to disk.
+ fsync(fileno(f));
+ fseek(f, sizeof(int), SEEK_SET);
+ fwrite("ENIGMA_EPG_V7", 13, 1, f);
fclose(f);
#if 0
unsigned char md5[16];