diff --git a/src/zapit/include/zapit/getservices.h b/src/zapit/include/zapit/getservices.h index 2aa4616c2..780b525c0 100644 --- a/src/zapit/include/zapit/getservices.h +++ b/src/zapit/include/zapit/getservices.h @@ -107,7 +107,7 @@ class CServiceManager ~CServiceManager(); static CServiceManager * getInstance(); - static void CopyFile(char * from, char * to); + static void CopyFile(const char * from, const char * to); bool InitSatPosition(t_satellite_position position, const char * name = NULL, bool force = false, delivery_system_t delsys = DVB_S, uint16_t nid = 0); bool LoadServices(bool only_current); diff --git a/src/zapit/src/getservices.cpp b/src/zapit/src/getservices.cpp index 3918082a9..0c7052283 100644 --- a/src/zapit/src/getservices.cpp +++ b/src/zapit/src/getservices.cpp @@ -33,6 +33,7 @@ #include #include #include +#include //#define SAVE_DEBUG @@ -968,13 +969,18 @@ do_current: return true; } -void CServiceManager::CopyFile(char * from, char * to) +void CServiceManager::CopyFile(const char * from, const char * to) { - char cmd[256] = "cp -f "; - strcat(cmd, from); - strcat(cmd, " "); - strcat(cmd, to); - system(cmd); + std::ifstream in(from, std::ios::in | std::ios::binary); + if(in.good()){ + std::ofstream out(to, std::ios::out | std::ios::binary); + if(out.good()){ + out << in.rdbuf(); + out.close(); + } + in.close(); + remove(from); + } sync(); }