aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2014-03-12 16:49:50 +0100
committerSverker Eriksson <[email protected]>2014-03-13 14:31:01 +0100
commitcb748a7989ed79cdac9454fe25a6b93b3b6f8393 (patch)
tree4cf711ab29433936c4cd30611355684f47ccb999
parent189e2f0313eb6cc96e92d2c7efb790cb4d9849a4 (diff)
downloadotp-cb748a7989ed79cdac9454fe25a6b93b3b6f8393.tar.gz
otp-cb748a7989ed79cdac9454fe25a6b93b3b6f8393.tar.bz2
otp-cb748a7989ed79cdac9454fe25a6b93b3b6f8393.zip
erts: Revert file:set_cwd impl for windows
No need to even try as CWD can not bee a long path anyway.
-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;
}