[pacman-dev,1/1] libalpm: use archive_write_finish for 2.x compat

Message ID 20180208083917.16047-2-i@jhuang.me
State Rejected, archived
Headers show
Series Fix libarchive 2 compatibility | expand

Commit Message

Huáng Jùnliàng Feb. 8, 2018, 8:39 a.m. UTC
The `archive_write_free` is a new function beginning with libarchive 3.0[1]. Since we require libarchive >= 2.8.0, we should use `archive_write_finish` for compatibility.

[1]: Note 5 from https://github.com/libarchive/libarchive/wiki/Examples#a-basic-write-example

Signed-off-by: Huáng Jùnliàng <i@jhuang.me>
---
 lib/libalpm/add.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Allan McRae Feb. 8, 2018, 10:43 p.m. UTC | #1
libarchive 3.0 was released at the start of 2012 and
archive_write_free() will be removed in libarchive 4.0.  Just bump
minimum libarchive requirements.

Thanks,
Allan

PS - no need to send a cover letter when only posting one patch.

On 08/02/18 18:39, Huáng Jùnliàng wrote:
> The `archive_write_free` is a new function beginning with libarchive 3.0[1]. Since we require libarchive >= 2.8.0, we should use `archive_write_finish` for compatibility.
> 
> [1]: Note 5 from https://github.com/libarchive/libarchive/wiki/Examples#a-basic-write-example
> 
> Signed-off-by: Huáng Jùnliàng <i@jhuang.me>
> ---
>  lib/libalpm/add.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
> index 0beed01c..b7f47a57 100644
> --- a/lib/libalpm/add.c
> +++ b/lib/libalpm/add.c
> @@ -131,7 +131,7 @@ static int perform_extraction(alpm_handle_t *handle, struct archive *archive,
>  
>  	ret = archive_read_extract2(archive, entry, archive_writer);
>  
> -	archive_write_free(archive_writer);
> +	archive_write_finish(archive_writer);
>  
>  	if(ret == ARCHIVE_WARN && archive_errno(archive) != ENOSPC) {
>  		/* operation succeeded but a "non-critical" error was encountered */
>

Patch

diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 0beed01c..b7f47a57 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -131,7 +131,7 @@  static int perform_extraction(alpm_handle_t *handle, struct archive *archive,
 
 	ret = archive_read_extract2(archive, entry, archive_writer);
 
-	archive_write_free(archive_writer);
+	archive_write_finish(archive_writer);
 
 	if(ret == ARCHIVE_WARN && archive_errno(archive) != ENOSPC) {
 		/* operation succeeded but a "non-critical" error was encountered */