- // Open the source and destintation files
- FileFd From(Path,FileFd::ReadOnly);
- FileFd To(Itm->DestFile,FileFd::WriteEmpty);
+ // Open the source and destination files
+ FileFd From(Path,FileFd::ReadOnlyGzip);
+
+ // if the file is empty, just rename it and return
+ if(From.Size() == 0)
+ {
+ rename(Path.c_str(), Itm->DestFile.c_str());
+ return true;
+ }
+
+ FileFd To(Itm->DestFile,FileFd::WriteAtomic);