src/pxar/encoder.rs: fix bug with incorrect offset stored in goodbye table

Commit cd7dc87903 introduced the special treatment
for .pxarexclude files when stored in the archive.
The incorrect placement of a code snipplet from this path leads to an incorrect
offset and size stored in the goodbye table.
This fix places the start to the correct position, restoring the previously
correct behaviour.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2019-07-04 14:24:13 +02:00 committed by Dietmar Maurer
parent 7dcbe051e9
commit 48a4509c67

View File

@ -676,6 +676,8 @@ impl <'a, W: Write> Encoder<'a, W> {
let mut goodbye_items = vec![];
for (filename, stat, exclude_list) in name_list {
let start_pos = self.writer_pos;
if filename.as_bytes() == b".pxarexclude" {
if let Some((ref content, ref stat)) = pxar_exclude {
let filefd = match nix::fcntl::openat(rawfd, filename.as_ref(), OFlag::O_NOFOLLOW, Mode::empty()) {
@ -706,8 +708,6 @@ impl <'a, W: Write> Encoder<'a, W> {
if self.verbose { println!("{:?}", self.full_path()); }
let start_pos = self.writer_pos;
if is_directory(&stat) {
let mut dir = match nix::dir::Dir::openat(rawfd, filename.as_ref(), OFlag::O_DIRECTORY|OFlag::O_NOFOLLOW, Mode::empty()) {