diff options
author | Sverker Eriksson <sverker@erlang.org> | 2014-03-12 17:07:16 +0100 |
---|---|---|
committer | Sverker Eriksson <sverker@erlang.org> | 2014-03-24 21:09:49 +0100 |
commit | 2d2ce325546bc93178d1343e2a53911b890cc259 (patch) | |
tree | 9ade83ec1d0b459ac2c6f45d5979fe8248528433 | |
parent | cb748a7989ed79cdac9454fe25a6b93b3b6f8393 (diff) | |
download | otp-2d2ce325546bc93178d1343e2a53911b890cc259.tar.gz otp-2d2ce325546bc93178d1343e2a53911b890cc259.tar.bz2 otp-2d2ce325546bc93178d1343e2a53911b890cc259.zip |
erts: Make file:make_symlink/2 return {error,eperm} on Windows
if the user has not the privilege SE_CREATE_SYMBOLIC_LINK_NAME
-rw-r--r-- | erts/emulator/drivers/win32/win_efile.c | 2 | ||||
-rw-r--r-- | lib/kernel/doc/src/file.xml | 7 | ||||
-rw-r--r-- | lib/kernel/test/file_SUITE.erl | 9 |
3 files changed, 16 insertions, 2 deletions
diff --git a/erts/emulator/drivers/win32/win_efile.c b/erts/emulator/drivers/win32/win_efile.c index 3236da8a98..3d3a5bcb84 100644 --- a/erts/emulator/drivers/win32/win_efile.c +++ b/erts/emulator/drivers/win32/win_efile.c @@ -251,6 +251,8 @@ static int errno_map(DWORD last_error) { return EAGAIN; case ERROR_CANT_RESOLVE_FILENAME: return EMLINK; + case ERROR_PRIVILEGE_NOT_HELD: + return EPERM; case ERROR_ARENA_TRASHED: case ERROR_INVALID_BLOCK: case ERROR_BAD_ENVIRONMENT: diff --git a/lib/kernel/doc/src/file.xml b/lib/kernel/doc/src/file.xml index 7b8d2940c1..6437855f94 100644 --- a/lib/kernel/doc/src/file.xml +++ b/lib/kernel/doc/src/file.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1996</year><year>2013</year> + <year>1996</year><year>2014</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -642,6 +642,11 @@ <item> <p>Symbolic links are not supported on this platform.</p> </item> + <tag><c>eperm</c></tag> + <item> + <p>User does not have privileges to create symbolic links + (<c>SeCreateSymbolicLinkPrivilege</c> on Windows).</p> + </item> </taglist> </desc> </func> diff --git a/lib/kernel/test/file_SUITE.erl b/lib/kernel/test/file_SUITE.erl index a6e4e639f4..e4eca4b756 100644 --- a/lib/kernel/test/file_SUITE.erl +++ b/lib/kernel/test/file_SUITE.erl @@ -2670,6 +2670,9 @@ symlinks(Config) when is_list(Config) -> case ?FILE_MODULE:make_symlink(Name, Alias) of {error, enotsup} -> {skipped, "Links not supported on this platform"}; + {error, eperm} -> + {win32,_} = os:type(), + {skipped, "Windows user not privileged to create symlinks"}; ok -> ?line {ok, Info1} = ?FILE_MODULE:read_file_info(Name), ?line {ok, Info1} = ?FILE_MODULE:read_file_info(Alias), @@ -3596,7 +3599,11 @@ otp_10852(Config) when is_list(Config) -> ok = rpc_call(Node, list_dir_all, [B]), ok = rpc_call(Node, read_file, [B]), ok = rpc_call(Node, make_link, [B,B]), - ok = rpc_call(Node, make_symlink, [B,B]), + case rpc_call(Node, make_symlink, [B,B]) of + ok -> ok; + {error, E} when (E =:= enotsup) or (E =:= eperm) -> + {win32,_} = os:type() + end, ok = rpc_call(Node, delete, [B]), ok = rpc_call(Node, make_dir, [B]), ok = rpc_call(Node, del_dir, [B]), |