diff options
Diffstat (limited to '')
-rw-r--r-- | archival/libarchive/unsafe_symlink_target.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/archival/libarchive/unsafe_symlink_target.c b/archival/libarchive/unsafe_symlink_target.c index f8dc8033d..d9100f30f 100644 --- a/archival/libarchive/unsafe_symlink_target.c +++ b/archival/libarchive/unsafe_symlink_target.c | |||
@@ -10,18 +10,26 @@ void FAST_FUNC create_or_remember_link(llist_t **link_placeholders, | |||
10 | const char *linkname, | 10 | const char *linkname, |
11 | int hard_link) | 11 | int hard_link) |
12 | { | 12 | { |
13 | #if ENABLE_PLATFORM_MINGW32 | ||
14 | /* defer reporting error if symlink(2) fails on Windows */ | ||
15 | if (hard_link || target[0] == '/' || strstr(target, "..") || | ||
16 | symlink(target, linkname) != 0) { | ||
17 | #else | ||
13 | if (hard_link || target[0] == '/' || strstr(target, "..")) { | 18 | if (hard_link || target[0] == '/' || strstr(target, "..")) { |
19 | #endif | ||
14 | llist_add_to_end(link_placeholders, | 20 | llist_add_to_end(link_placeholders, |
15 | xasprintf("%c%s%c%s", hard_link, linkname, '\0', target) | 21 | xasprintf("%c%s%c%s", hard_link, linkname, '\0', target) |
16 | ); | 22 | ); |
17 | return; | 23 | return; |
18 | } | 24 | } |
25 | #if !ENABLE_PLATFORM_MINGW32 | ||
19 | if (symlink(target, linkname) != 0) { | 26 | if (symlink(target, linkname) != 0) { |
20 | /* shared message */ | 27 | /* shared message */ |
21 | bb_perror_msg_and_die("can't create %slink '%s' to '%s'", | 28 | bb_perror_msg_and_die("can't create %slink '%s' to '%s'", |
22 | "sym", linkname, target | 29 | "sym", linkname, target |
23 | ); | 30 | ); |
24 | } | 31 | } |
32 | #endif | ||
25 | } | 33 | } |
26 | 34 | ||
27 | void FAST_FUNC create_links_from_list(llist_t *list) | 35 | void FAST_FUNC create_links_from_list(llist_t *list) |