diff options
author | Björn Gustavsson <[email protected]> | 2013-02-12 14:30:13 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2013-02-12 14:30:13 +0100 |
commit | cd08400f92ec7672025bf39a458effcf33a423dc (patch) | |
tree | b874f8c3fe97558d72dcaedc31dd941060ccea75 /erts/preloaded/src/erl_prim_loader.erl | |
parent | bbf692965470a9e993e1afd6f1a9375cbe832fcb (diff) | |
parent | 08bc8a328275e751836fab0c562b50cf71000c2b (diff) | |
download | otp-cd08400f92ec7672025bf39a458effcf33a423dc.tar.gz otp-cd08400f92ec7672025bf39a458effcf33a423dc.tar.bz2 otp-cd08400f92ec7672025bf39a458effcf33a423dc.zip |
Merge branch 'pan/unicode_filename_warnings'
* pan/unicode_filename_warnings:
Add file:list_dir_all/1 and file:read_link_all/1
prim_file: Add list_dir_all() and read_link_all()
Teach prim_file:set_cwd() to avoid entering non-translatable directories
Make prim_file skip invalid filenames in unicode mode
prim_file: Refactor functions that return filenames
prim_file: Refactor handling of responses
prim_file: Always open non-file ports in binary mode
Test that list_dir("non-existing-dir") fails with the correct error
Diffstat (limited to 'erts/preloaded/src/erl_prim_loader.erl')
-rw-r--r-- | erts/preloaded/src/erl_prim_loader.erl | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/erts/preloaded/src/erl_prim_loader.erl b/erts/preloaded/src/erl_prim_loader.erl index d36fdeba3f..7490954f2d 100644 --- a/erts/preloaded/src/erl_prim_loader.erl +++ b/erts/preloaded/src/erl_prim_loader.erl @@ -149,8 +149,18 @@ start_it("inet", Id, Pid, Hosts) -> start_it("efile", Id, Pid, _Hosts) -> process_flag(trap_exit, true), - {ok, Port} = prim_file:open([binary]), - init_ack(Pid), + {ok, Port} = prim_file:start(), + %% Check that we started in a valid directory. + case prim_file:get_cwd(Port) of + {error, _} -> + %% At this point in the startup, we have no error_logger at all. + Report = "Invalid current directory or invalid filename " + "mode: loader cannot read current directory\n", + erlang:display(Report), + exit({error, invalid_current_directory}); + _ -> + init_ack(Pid) + end, MultiGet = case erlang:system_info(thread_pool_size) of 0 -> false; _ -> true @@ -434,7 +444,7 @@ efile_multi_get_file_from_port2(_MFs, 0, _Max, State, _Paths, _Fun, _Ref, Ret) - efile_par_get_file(Ref, State, {Mod,File} = MF, Paths, Pid, Fun) -> %% One port for each file read in "parallel": - case prim_file:open([binary]) of + case prim_file:start() of {ok, Port} -> Port0 = State#state.data, State1 = State#state{data = Port}, |