diff options
Diffstat (limited to 'meta/recipes-devtools/opkg/opkg/0001-opkg_archive-add-support-for-empty-compressed-files.patch')
-rw-r--r-- | meta/recipes-devtools/opkg/opkg/0001-opkg_archive-add-support-for-empty-compressed-files.patch | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/meta/recipes-devtools/opkg/opkg/0001-opkg_archive-add-support-for-empty-compressed-files.patch b/meta/recipes-devtools/opkg/opkg/0001-opkg_archive-add-support-for-empty-compressed-files.patch new file mode 100644 index 0000000000..dabd196d2c --- /dev/null +++ b/meta/recipes-devtools/opkg/opkg/0001-opkg_archive-add-support-for-empty-compressed-files.patch | |||
@@ -0,0 +1,64 @@ | |||
1 | From bd32bb8646459508bb0b0ce54a14bd6fe0e19b75 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alejandro del Castillo <alejandro.delcastillo@ni.com> | ||
3 | Date: Thu, 27 Aug 2015 15:52:16 -0500 | ||
4 | Subject: [PATCH] opkg_archive: add support for empty compressed files | ||
5 | |||
6 | Regression from 0.2.x: opkg used to support empty Package.gz files. | ||
7 | |||
8 | Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com> | ||
9 | |||
10 | Upstream-Status: Accepted | ||
11 | --- | ||
12 | libopkg/opkg_archive.c | 15 +++++++++++++-- | ||
13 | 1 file changed, 13 insertions(+), 2 deletions(-) | ||
14 | |||
15 | diff --git a/libopkg/opkg_archive.c b/libopkg/opkg_archive.c | ||
16 | index be903e4..7e91e48 100644 | ||
17 | --- a/libopkg/opkg_archive.c | ||
18 | +++ b/libopkg/opkg_archive.c | ||
19 | @@ -121,6 +121,9 @@ static int copy_to_stream(struct archive *a, FILE * stream) | ||
20 | int eof; | ||
21 | size_t len = EXTRACT_BUFFER_LEN; | ||
22 | |||
23 | + if (archive_format(a) == ARCHIVE_FORMAT_EMPTY) | ||
24 | + return 0; | ||
25 | + | ||
26 | buffer = xmalloc(len); | ||
27 | |||
28 | while (1) { | ||
29 | @@ -654,6 +657,13 @@ static struct archive *open_compressed_file(const char *filename) | ||
30 | goto err_cleanup; | ||
31 | } | ||
32 | |||
33 | + r = archive_read_support_format_empty(ar); | ||
34 | + if (r != ARCHIVE_OK) { | ||
35 | + opkg_msg(ERROR, "Empty format not supported: %s\n", | ||
36 | + archive_error_string(ar)); | ||
37 | + goto err_cleanup; | ||
38 | + } | ||
39 | + | ||
40 | /* Open input file and prepare for reading. */ | ||
41 | r = archive_read_open_filename(ar, filename, EXTRACT_BUFFER_LEN); | ||
42 | if (r != ARCHIVE_OK) { | ||
43 | @@ -723,6 +733,7 @@ struct opkg_ar *ar_open_compressed_file(const char *filename) | ||
44 | { | ||
45 | struct opkg_ar *ar; | ||
46 | struct archive_entry *entry; | ||
47 | + int eof; | ||
48 | |||
49 | ar = (struct opkg_ar *)xmalloc(sizeof(struct opkg_ar)); | ||
50 | |||
51 | @@ -737,8 +748,8 @@ struct opkg_ar *ar_open_compressed_file(const char *filename) | ||
52 | * header. We skip over this header here so that the caller doesn't need | ||
53 | * to know about it. | ||
54 | */ | ||
55 | - entry = read_header(ar->ar, NULL); | ||
56 | - if (!entry) | ||
57 | + entry = read_header(ar->ar, &eof); | ||
58 | + if (!entry && !eof) | ||
59 | goto err_cleanup; | ||
60 | |||
61 | return ar; | ||
62 | -- | ||
63 | 1.9.1 | ||
64 | |||