diff --git a/archive/pc_arc_filter.c b/archive/pc_arc_filter.c index 2d98679..1664916 100644 --- a/archive/pc_arc_filter.c +++ b/archive/pc_arc_filter.c @@ -195,8 +195,8 @@ packjpg_filter(struct filter_info *fi, void *filter_private) */ if ((mapbuf[0] != 'J' && mapbuf[1] != 'S') || (pjdat->in_buff[0] == 0xFF && pjdat->in_buff[1] == 0xD8)) { - return (write_archive_data(fi->target_arc, mapbuf, in_size, - fi->block_size)); + return (write_archive_data(fi->target_arc, pjdat->in_buff, + in_size, fi->block_size)); } } if (pjdat->bufflen < len) { @@ -218,8 +218,10 @@ packjpg_filter(struct filter_info *fi, void *filter_private) out = pjdat->buff; if ((len = packjpg_filter_process(mapbuf, len, &out)) == 0) { + munmap(mapbuf, len1); return (FILTER_RETURN_SKIP); } + munmap(mapbuf, len1); in_size = LE64(len); rv = archive_write_data(fi->target_arc, &in_size, 8); diff --git a/archive/pc_archive.c b/archive/pc_archive.c index 17f0f97..ff1f13d 100644 --- a/archive/pc_archive.c +++ b/archive/pc_archive.c @@ -842,7 +842,6 @@ process_by_filter(int fd, int typ, struct archive *target_arc, fi.compressing = cmp; fi.block_size = AW_BLOCK_SIZE; wrtn = (*(typetab[(typ >> 3)].filter_func))(&fi, typetab[(typ >> 3)].filter_private); - close(fd); if (wrtn == FILTER_RETURN_ERROR) { log_msg(LOG_ERR, 0, "Error invoking filter module: %s", typetab[(typ >> 3)].filter_name); @@ -881,9 +880,7 @@ copy_file_data(pc_ctx_t *pctx, struct archive *arc, struct archive_entry *entry, rv = process_by_filter(fd, typ, arc, NULL, entry, 1); if (rv == FILTER_RETURN_ERROR) return (-1); - else if (rv == FILTER_RETURN_SKIP) - lseek(fd, 0, SEEK_SET); - else + else if (rv != FILTER_RETURN_SKIP) return (ARCHIVE_OK); } }