The following commit has been merged in the master branch: commit b634df88030148e44878794622f2cc07e191eb8f Author: Guillem Jover <guil...@debian.org> Date: Thu Mar 15 17:51:11 2012 +0100
dpkg: Refactor skipping tarobject padding into new tarobject_skip_padding() diff --git a/src/archives.c b/src/archives.c index 083c5b3..3d44ea4 100644 --- a/src/archives.c +++ b/src/archives.c @@ -183,11 +183,20 @@ int tarfileread(void *ud, char *buf, int len) { } static void -tarobject_skip_entry(struct tarcontext *tc, struct tar_entry *ti) +tarobject_skip_padding(struct tarcontext *tc, struct tar_entry *te) { size_t r; char databuf[TARBLKSZ]; + r = te->size % TARBLKSZ; + if (r > 0) + if (fd_read(tc->backendpipe, databuf, TARBLKSZ - r) < 0) + ohshite(_("error reading from dpkg-deb pipe")); +} + +static void +tarobject_skip_entry(struct tarcontext *tc, struct tar_entry *ti) +{ /* We need to advance the tar file to the next object, so read the * file data and set it to oblivion. */ if (ti->type == tar_filetype_file) { @@ -196,10 +205,7 @@ tarobject_skip_entry(struct tarcontext *tc, struct tar_entry *ti) fd_skip(tc->backendpipe, ti->size, _("skipped unpacking file '%.255s' (replaced or excluded?)"), path_quote_filename(fnamebuf, ti->name, 256)); - r = ti->size % TARBLKSZ; - if (r > 0) - if (fd_read(tc->backendpipe, databuf, TARBLKSZ - r) < 0) - ohshite(_("error reading from dpkg-deb pipe")); + tarobject_skip_padding(tc, ti); } } @@ -248,9 +254,7 @@ tarobject_extract(struct tarcontext *tc, struct tar_entry *te, static int fd; struct filenamenode *linknode; - char databuf[TARBLKSZ]; char fnamebuf[256]; - ssize_t r; switch (te->type) { case tar_filetype_file: @@ -268,10 +272,7 @@ tarobject_extract(struct tarcontext *tc, struct tar_entry *te, _("backend dpkg-deb during `%.255s'"), path_quote_filename(fnamebuf, te->name, 256)); - r = te->size % TARBLKSZ; - if (r > 0) - if (fd_read(tc->backendpipe, databuf, TARBLKSZ - r) < 0) - ohshite(_("error reading from dpkg-deb pipe")); + tarobject_skip_padding(tc, te); fd_writeback_init(fd); -- dpkg's main repository -- To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org