aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2014-06-06 01:49:42 +0200
committerRickard Green <[email protected]>2014-06-06 01:49:42 +0200
commitc54a0025e6a4d152ba73e92a2007052ebde391bf (patch)
tree96547f56d48c53d197a5a70acd167c0bdcdaf4af /lib/kernel/src
parentd30fd47e2e886094d72d8dcb00f1392cabeda23f (diff)
parent8b4659d5246166cef9b8e9aa91c644e3b3ec66d5 (diff)
downloadotp-c54a0025e6a4d152ba73e92a2007052ebde391bf.tar.gz
otp-c54a0025e6a4d152ba73e92a2007052ebde391bf.tar.bz2
otp-c54a0025e6a4d152ba73e92a2007052ebde391bf.zip
Merge branch 'maint'
Diffstat (limited to 'lib/kernel/src')
-rw-r--r--lib/kernel/src/code_server.erl18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/kernel/src/code_server.erl b/lib/kernel/src/code_server.erl
index fc7ac08699..dd06affd70 100644
--- a/lib/kernel/src/code_server.erl
+++ b/lib/kernel/src/code_server.erl
@@ -63,7 +63,10 @@ init(Ref, Parent, [Root,Mode0]) ->
process_flag(trap_exit, true),
Db = ets:new(code, [private]),
- foreach(fun (M) -> ets:insert(Db, {M,preloaded}) end, erlang:pre_loaded()),
+ foreach(fun (M) ->
+ %% Pre-loaded modules are always sticky.
+ ets:insert(Db, [{M,preloaded},{{sticky,M},true}])
+ end, erlang:pre_loaded()),
ets:insert(Db, init:fetch_loaded()),
Mode =
@@ -988,7 +991,7 @@ try_archive_subdirs(_Archive, Base, []) ->
%% the complete directory name.
%%
del_path(Name0,Path,NameDb) ->
- case catch to_list(Name0)of
+ case catch filename:join([to_list(Name0)]) of
{'EXIT',_} ->
{{error,bad_name},Path};
Name ->
@@ -1165,7 +1168,7 @@ stick_dir(Dir, Stick, St) ->
true ->
foreach(fun (M) -> ets:insert(Db, {{sticky,M},true}) end, Mods);
false ->
- foreach(fun (M) -> ets:delete(Db, {sticky,M}) end, Mods)
+ foreach(fun (M) -> do_unstick_mod(Db, M) end, Mods)
end;
Error ->
Error
@@ -1177,6 +1180,15 @@ stick_mod(M, Stick, St) ->
true ->
ets:insert(Db, {{sticky,M},true});
false ->
+ do_unstick_mod(Db, M)
+ end.
+
+do_unstick_mod(Db, M) ->
+ case ets:lookup(Db, M) of
+ [{M,preloaded}] ->
+ %% Never unstick pre-loaded modules.
+ true;
+ _ ->
ets:delete(Db, {sticky,M})
end.