diff options
author | Ron Yorston <rmy@pobox.com> | 2018-04-09 08:30:13 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2018-04-09 08:30:13 +0100 |
commit | 5b6f06f5eb8628955262508d153627fe6f2d1c8b (patch) | |
tree | 25ea1776f833936cf4884a99610778c1578b70f5 | |
parent | 13fc352af9a47da92ac0198c7a862c722f143508 (diff) | |
download | busybox-w32-5b6f06f5eb8628955262508d153627fe6f2d1c8b.tar.gz busybox-w32-5b6f06f5eb8628955262508d153627fe6f2d1c8b.tar.bz2 busybox-w32-5b6f06f5eb8628955262508d153627fe6f2d1c8b.zip |
libarchive: failure to extract symlink isn't fatal
Recent upstream changes made the failure of symlink(2) when extracting
from an archive a fatal error.
The busybox-w32 implementation of symlink(2) always fails. Just
issue a warning and move on.
-rw-r--r-- | archival/libarchive/unsafe_symlink_target.c | 10 | ||||
-rw-r--r-- | include/bb_archive.h | 4 |
2 files changed, 13 insertions, 1 deletions
diff --git a/archival/libarchive/unsafe_symlink_target.c b/archival/libarchive/unsafe_symlink_target.c index 8dcafeaa1..0ad4c9392 100644 --- a/archival/libarchive/unsafe_symlink_target.c +++ b/archival/libarchive/unsafe_symlink_target.c | |||
@@ -5,10 +5,12 @@ | |||
5 | #include "libbb.h" | 5 | #include "libbb.h" |
6 | #include "bb_archive.h" | 6 | #include "bb_archive.h" |
7 | 7 | ||
8 | void FAST_FUNC create_or_remember_symlink(llist_t **symlink_placeholders, | 8 | void FAST_FUNC create_or_remember_symlink(llist_t **symlink_placeholders |
9 | IF_PLATFORM_MINGW32(UNUSED_PARAM), | ||
9 | const char *target, | 10 | const char *target, |
10 | const char *linkname) | 11 | const char *linkname) |
11 | { | 12 | { |
13 | #if !ENABLE_PLATFORM_MINGW32 | ||
12 | if (target[0] == '/' || strstr(target, "..")) { | 14 | if (target[0] == '/' || strstr(target, "..")) { |
13 | llist_add_to(symlink_placeholders, | 15 | llist_add_to(symlink_placeholders, |
14 | xasprintf("%s%c%s", linkname, '\0', target) | 16 | xasprintf("%s%c%s", linkname, '\0', target) |
@@ -21,8 +23,13 @@ void FAST_FUNC create_or_remember_symlink(llist_t **symlink_placeholders, | |||
21 | "sym", linkname, target | 23 | "sym", linkname, target |
22 | ); | 24 | ); |
23 | } | 25 | } |
26 | #else | ||
27 | /* symlink isn't implemented for WIN32, just issue a warning */ | ||
28 | bb_perror_msg("can't create %slink '%s' to '%s'", "sym", linkname, target); | ||
29 | #endif | ||
24 | } | 30 | } |
25 | 31 | ||
32 | #if !ENABLE_PLATFORM_MINGW32 | ||
26 | void FAST_FUNC create_symlinks_from_list(llist_t *list) | 33 | void FAST_FUNC create_symlinks_from_list(llist_t *list) |
27 | { | 34 | { |
28 | while (list) { | 35 | while (list) { |
@@ -39,3 +46,4 @@ void FAST_FUNC create_symlinks_from_list(llist_t *list) | |||
39 | list = list->link; | 46 | list = list->link; |
40 | } | 47 | } |
41 | } | 48 | } |
49 | #endif | ||
diff --git a/include/bb_archive.h b/include/bb_archive.h index 8028736b8..91d5561fc 100644 --- a/include/bb_archive.h +++ b/include/bb_archive.h | |||
@@ -212,7 +212,11 @@ const char *strip_unsafe_prefix(const char *str) FAST_FUNC; | |||
212 | void create_or_remember_symlink(llist_t **symlink_placeholders, | 212 | void create_or_remember_symlink(llist_t **symlink_placeholders, |
213 | const char *target, | 213 | const char *target, |
214 | const char *linkname) FAST_FUNC; | 214 | const char *linkname) FAST_FUNC; |
215 | #if !ENABLE_PLATFORM_MINGW32 | ||
215 | void create_symlinks_from_list(llist_t *list) FAST_FUNC; | 216 | void create_symlinks_from_list(llist_t *list) FAST_FUNC; |
217 | #else | ||
218 | #define create_symlinks_from_list(l) (void)0 | ||
219 | #endif | ||
216 | 220 | ||
217 | void data_align(archive_handle_t *archive_handle, unsigned boundary) FAST_FUNC; | 221 | void data_align(archive_handle_t *archive_handle, unsigned boundary) FAST_FUNC; |
218 | const llist_t *find_list_entry(const llist_t *list, const char *filename) FAST_FUNC; | 222 | const llist_t *find_list_entry(const llist_t *list, const char *filename) FAST_FUNC; |