aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2014-03-12 16:39:29 +0100
committerSverker Eriksson <[email protected]>2014-03-13 14:31:01 +0100
commit189e2f0313eb6cc96e92d2c7efb790cb4d9849a4 (patch)
tree67d5beac54532bad418174de2fdab4f127629a88
parent4fa7202d3c816834e39cf7dce7aa10591babbf61 (diff)
downloadotp-189e2f0313eb6cc96e92d2c7efb790cb4d9849a4.tar.gz
otp-189e2f0313eb6cc96e92d2c7efb790cb4d9849a4.tar.bz2
otp-189e2f0313eb6cc96e92d2c7efb790cb4d9849a4.zip
erts: Ignore reduntant slashes in windows paths
-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;
}