From c7e089c9ac1847d89333e8d9adf7a3ec2b9d893d Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Tue, 24 Mar 2015 21:00:44 +0100 Subject: [PATCH] chhecking if epgdir directory exists for frequently save Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/22399f73e24cec2a393166875acf8c5115c33471 Author: Jacek Jendrzej Date: 2015-03-24 (Tue, 24 Mar 2015) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/eitd/sectionsd.cpp | 2 +- src/eitd/xmlutil.cpp | 11 ++++++++--- src/eitd/xmlutil.h | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index e94ef3a8d..7af727702 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -2087,7 +2087,7 @@ static void *houseKeepingThread(void *) if (*it == '/') d.erase(it); } - writeEventsToFile((char *)d.c_str()); + writeEventsToFile(d.c_str()); } ecount = 0; } diff --git a/src/eitd/xmlutil.cpp b/src/eitd/xmlutil.cpp index d21dca4e7..5dd8add9e 100644 --- a/src/eitd/xmlutil.cpp +++ b/src/eitd/xmlutil.cpp @@ -29,8 +29,8 @@ #include #include #include - #include +#include #include #include @@ -258,7 +258,7 @@ void readDVBTimeFilter(void) } } -void deleteOldfileEvents(char *epgdir) +void deleteOldfileEvents(const char *epgdir) { std::string indexname = std::string(epgdir) + "/index.xml"; xmlDocPtr filter_parser = parseXmlFile(indexname.c_str()); @@ -515,8 +515,13 @@ static void write_indexxml_footer(FILE *fd) fprintf(fd, "\n"); } -void writeEventsToFile(char *epgdir) +void writeEventsToFile(const char *epgdir) { + struct stat my_stat; + if(stat(epgdir, &my_stat) != 0){ + return; + } + FILE * indexfile = NULL; FILE * eventfile = NULL; std::string filename(""); diff --git a/src/eitd/xmlutil.h b/src/eitd/xmlutil.h index 298bb54c4..033318cb2 100644 --- a/src/eitd/xmlutil.h +++ b/src/eitd/xmlutil.h @@ -35,7 +35,7 @@ #include void *insertEventsfromFile(void * data); -void writeEventsToFile(char *epgdir); +void writeEventsToFile(const char *epgdir); bool readEPGFilter(void); void readDVBTimeFilter(void);