aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libarchive/libarchive/archive_write_open_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libarchive/libarchive/archive_write_open_file.c')
-rw-r--r--contrib/libarchive/libarchive/archive_write_open_file.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/contrib/libarchive/libarchive/archive_write_open_file.c b/contrib/libarchive/libarchive/archive_write_open_file.c
index 68bf236f8ecf..fb5c9c734cd0 100644
--- a/contrib/libarchive/libarchive/archive_write_open_file.c
+++ b/contrib/libarchive/libarchive/archive_write_open_file.c
@@ -51,7 +51,7 @@ struct write_FILE_data {
FILE *f;
};
-static int file_close(struct archive *, void *);
+static int file_free(struct archive *, void *);
static int file_open(struct archive *, void *);
static ssize_t file_write(struct archive *, void *, const void *buff, size_t);
@@ -66,8 +66,8 @@ archive_write_open_FILE(struct archive *a, FILE *f)
return (ARCHIVE_FATAL);
}
mine->f = f;
- return (archive_write_open(a, mine,
- file_open, file_write, file_close));
+ return (archive_write_open2(a, mine, file_open, file_write,
+ NULL, file_free));
}
static int
@@ -99,11 +99,13 @@ file_write(struct archive *a, void *client_data, const void *buff, size_t length
}
static int
-file_close(struct archive *a, void *client_data)
+file_free(struct archive *a, void *client_data)
{
struct write_FILE_data *mine = client_data;
(void)a; /* UNUSED */
+ if (mine == NULL)
+ return (ARCHIVE_OK);
free(mine);
return (ARCHIVE_OK);
}