aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/drivers/win32/win_efile.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/erts/emulator/drivers/win32/win_efile.c b/erts/emulator/drivers/win32/win_efile.c
index afb0252724..c25fb34637 100644
--- a/erts/emulator/drivers/win32/win_efile.c
+++ b/erts/emulator/drivers/win32/win_efile.c
@@ -370,8 +370,16 @@ static void ensure_wpath_max(Efile_call_state* state, WCHAR** pathp, size_t max)
*pathp = wpath_tmp_alloc(state, 4+len+1);
dst = *pathp;
wcscpy(dst, L"\\\\?\\");
- for (src=path,dst+=4; *src; src++,dst++)
- *dst = (*src == L'/') ? L'\\' : *src;
+ for (src=path,dst+=4; *src; src++) {
+ if (*src == L'/') {
+ if (dst[-1] != L'\\') {
+ *dst++ = L'\\';
+ }
+ /*else ignore redundant slashes */
+ }
+ else
+ *dst++ = *src;
+ }
*dst = 0;
unc_fixup = 1;
}