From cb748a7989ed79cdac9454fe25a6b93b3b6f8393 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Wed, 12 Mar 2014 16:49:50 +0100 Subject: erts: Revert file:set_cwd impl for windows No need to even try as CWD can not bee a long path anyway. --- erts/emulator/drivers/win32/win_efile.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'erts/emulator/drivers') 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; } -- cgit v1.2.3