mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-15 07:16:13 -04:00
Fix extractor
This commit is contained in:
parent
9727d56be8
commit
85981ff794
@ -161,9 +161,11 @@ void filesystem_extractor_<LoggerPolicy>::extract(filesystem_v2& fs,
|
|||||||
if (auto ranges = fs.readv(fd, size, 0)) {
|
if (auto ranges = fs.readv(fd, size, 0)) {
|
||||||
archiver.add_job(
|
archiver.add_job(
|
||||||
[this, &sem, ranges = std::move(*ranges), ae, size]() mutable {
|
[this, &sem, ranges = std::move(*ranges), ae, size]() mutable {
|
||||||
|
LOG_TRACE << "archiving " << ::archive_entry_pathname(ae);
|
||||||
check_result(::archive_write_header(a_, ae));
|
check_result(::archive_write_header(a_, ae));
|
||||||
for (auto& r : ranges) {
|
for (auto& r : ranges) {
|
||||||
auto br = r.get();
|
auto br = r.get();
|
||||||
|
LOG_TRACE << "writing " << br.size() << " bytes";
|
||||||
check_result(::archive_write_data(a_, br.data(), br.size()));
|
check_result(::archive_write_data(a_, br.data(), br.size()));
|
||||||
}
|
}
|
||||||
sem.post(size);
|
sem.post(size);
|
||||||
@ -195,15 +197,11 @@ void filesystem_extractor_<LoggerPolicy>::extract(filesystem_v2& fs,
|
|||||||
DWARFS_THROW(runtime_error, "getattr() failed");
|
DWARFS_THROW(runtime_error, "getattr() failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string path;
|
auto path = entry.path();
|
||||||
path.reserve(256);
|
|
||||||
entry.append_path_to(path);
|
|
||||||
if (!path.empty()) {
|
|
||||||
path += '/';
|
|
||||||
}
|
|
||||||
path += entry.name();
|
|
||||||
|
|
||||||
::archive_entry_set_pathname(ae, path.c_str());
|
DWARFS_CHECK(path[0] == '/', "path expected to start with /");
|
||||||
|
|
||||||
|
::archive_entry_set_pathname(ae, path.c_str() + 1); // drop leading /
|
||||||
::archive_entry_copy_stat(ae, &stbuf);
|
::archive_entry_copy_stat(ae, &stbuf);
|
||||||
|
|
||||||
if (S_ISLNK(inode.mode())) {
|
if (S_ISLNK(inode.mode())) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user