Skip to content

Commit 44e75b6

Browse files
committed
Fix UNC path handling
1 parent 5403913 commit 44e75b6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

TSRM/tsrm_virtual_cwd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
315315
is_absolute = 1;
316316
#ifdef TSRM_WIN32
317317
} else if (IS_UNC_PATH(path_copy, path_length)) {
318-
copy_amount = 1;
318+
copy_amount = 2;
319319
is_absolute = 1;
320320
} else if (IS_SLASH(path_copy[0])) {
321321
copy_amount = 2;
@@ -366,7 +366,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
366366
state->cwd = (char *) realloc(state->cwd, state->cwd_length+ptr_length+1+1);
367367
#ifdef TSRM_WIN32
368368
/* Windows 9x will consider C:\\Foo as a network path. Avoid it. */
369-
if (state->cwd[state->cwd_length-1]!=DEFAULT_SLASH) {
369+
if (state->cwd[state->cwd_length-1]!='\\' && state->cwd[state->cwd_length-1]!='/') {
370370
state->cwd[state->cwd_length++] = DEFAULT_SLASH;
371371
}
372372
#else

0 commit comments

Comments
 (0)