aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/drivers/win32
diff options
context:
space:
mode:
Diffstat (limited to 'erts/emulator/drivers/win32')
-rw-r--r--erts/emulator/drivers/win32/win_efile.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/erts/emulator/drivers/win32/win_efile.c b/erts/emulator/drivers/win32/win_efile.c
index c25fb34637..3236da8a98 100644
--- a/erts/emulator/drivers/win32/win_efile.c
+++ b/erts/emulator/drivers/win32/win_efile.c
@@ -870,24 +870,15 @@ do_rename(Efile_call_state* state,
int
efile_chdir(Efile_error* errInfo, /* Where to return error codes. */
char* name) /* Name of directory to make current. */
-{
- Efile_call_state state;
- WCHAR* wname = (WCHAR*)name;
- int success;
- SVERK_TRACE(1, name);
-
- call_state_init(&state, errInfo);
- ensure_wpath(&state, &wname);
- success = (int) SetCurrentDirectoryW(wname);
- if (!success) {
- set_error(state.errInfo);
- if (state.errInfo->posix_errno == EINVAL) {
- /* POSIXification of errno */
- errInfo->posix_errno = ENOENT;
- }
- }
-
- call_state_free(&state);
+{
+ /* We don't even try to handle long paths here
+ * as current working directory is always limited to MAX_PATH
+ * even if we use UNC paths and SetCurrentDirectoryW()
+ */
+ int success = check_error(_wchdir((WCHAR *) name), errInfo);
+ if (!success && errInfo->posix_errno == EINVAL)
+ /* POSIXification of errno */
+ errInfo->posix_errno = ENOENT;
return success;
}