|
@@ -288,12 +288,12 @@ FILE *FioFOpenFile(const std::string &fi
|
|
|
}
|
|
|
|
|
|
/* Resolve ONE directory link */
|
|
|
for (TarLinkList::iterator link = _tar_linklist[subdir].begin(); link != _tar_linklist[subdir].end(); link++) {
|
|
|
const std::string &src = link->first;
|
|
|
for (const auto &link : _tar_linklist[subdir]) {
|
|
|
const std::string &src = link.first;
|
|
|
size_t len = src.length();
|
|
|
if (resolved_name.length() >= len && resolved_name[len - 1] == PATHSEPCHAR && src.compare(0, len, resolved_name, 0, len) == 0) {
|
|
|
/* Apply link */
|
|
|
resolved_name.replace(0, len, link->second);
|
|
|
resolved_name.replace(0, len, link.second);
|
|
|
break; // Only resolve one level
|
|
|
}
|
|
|
}
|
|
@@ -666,10 +666,8 @@ bool TarScanner::AddFile(const std::stri
|
|
|
* The destination path must NOT contain any links.
|
|
|
* The source path may contain one directory link.
|
|
|
*/
|
|
|
for (TarLinkList::iterator link = links.begin(); link != links.end(); link++) {
|
|
|
const std::string &src = link->first;
|
|
|
const std::string &dest = link->second;
|
|
|
TarAddLink(src, dest, this->subdir);
|
|
|
for (auto &it : links) {
|
|
|
TarAddLink(it.first, it.second, this->subdir);
|
|
|
}
|
|
|
|
|
|
return true;
|
|
@@ -705,16 +703,16 @@ bool ExtractTar(const std::string &tar_f
|
|
|
Debug(misc, 8, "Extracting {} to directory {}", tar_filename, filename);
|
|
|
FioCreateDirectory(filename);
|
|
|
|
|
|
for (TarFileList::iterator it2 = _tar_filelist[subdir].begin(); it2 != _tar_filelist[subdir].end(); it2++) {
|
|
|
if (tar_filename != it2->second.tar_filename) continue;
|
|
|
for (auto &it2 : _tar_filelist[subdir]) {
|
|
|
if (tar_filename != it2.second.tar_filename) continue;
|
|
|
|
|
|
filename.replace(p + 1, std::string::npos, it2->first);
|
|
|
filename.replace(p + 1, std::string::npos, it2.first);
|
|
|
|
|
|
Debug(misc, 9, " extracting {}", filename);
|
|
|
|
|
|
/* First open the file in the .tar. */
|
|
|
size_t to_copy = 0;
|
|
|
std::unique_ptr<FILE, FileDeleter> in(FioFOpenFileTar(it2->second, &to_copy));
|
|
|
std::unique_ptr<FILE, FileDeleter> in(FioFOpenFileTar(it2.second, &to_copy));
|
|
|
if (!in) {
|
|
|
Debug(misc, 6, "Extracting {} failed; could not open {}", filename, tar_filename);
|
|
|
return false;
|