summaryrefslogtreecommitdiffstats
path: root/Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-06-20 14:50:13 (GMT)
committerBrad King <brad.king@kitware.com>2016-06-20 14:50:13 (GMT)
commit52f58267c311550db83f4a9430f378e730bd3d6b (patch)
tree589c3131934d49968c805236201c4196a7ab346b /Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c
parent9d81f1b3aaa82d12a3a87067572b3ff5e2b9c4d2 (diff)
parent2b94d71d8850d68b677d5653c698371528344a10 (diff)
downloadCMake-52f58267c311550db83f4a9430f378e730bd3d6b.zip
CMake-52f58267c311550db83f4a9430f378e730bd3d6b.tar.gz
CMake-52f58267c311550db83f4a9430f378e730bd3d6b.tar.bz2
Merge branch 'upstream-LibArchive' into update-libarchive
* upstream-LibArchive: LibArchive 2016-06-19 (139d0576)
Diffstat (limited to 'Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c')
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c b/Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c
index 800aa89..da76c54 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c
@@ -468,9 +468,17 @@ permissive_name_w(struct archive_write_disk *a)
return (-1);
archive_wstring_ensure(&(a->_name_data), 4 + l + 1 + wcslen(wn) + 1);
a->name = a->_name_data.s;
- /* Prepend "\\?\" and drive name. */
- archive_wstrncpy(&(a->_name_data), L"\\\\?\\", 4);
- archive_wstrncat(&(a->_name_data), wsp, l);
+ /* Prepend "\\?\" and drive name if not already added. */
+ if (l > 3 && wsp[0] == L'\\' && wsp[1] == L'\\' &&
+ wsp[2] == L'?' && wsp[3] == L'\\')
+ {
+ archive_wstrncpy(&(a->_name_data), wsp, l);
+ }
+ else
+ {
+ archive_wstrncpy(&(a->_name_data), L"\\\\?\\", 4);
+ archive_wstrncat(&(a->_name_data), wsp, l);
+ }
archive_wstrncat(&(a->_name_data), L"\\", 1);
archive_wstrcat(&(a->_name_data), wn);
a->name = a->_name_data.s;