aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/user_drv.erl
diff options
context:
space:
mode:
authorJonas Falkevik <[email protected]>2014-04-04 22:17:34 +0200
committerPeter Andersson <[email protected]>2015-04-22 12:24:49 +0200
commitfc130e699774228f396dc6f4fef4b654edc00451 (patch)
tree1bcf05705259af6b06a44c4c5fd41f2ef1a5847a /lib/kernel/src/user_drv.erl
parent67acde7a3522c651982a6789c749aaf73313e913 (diff)
downloadotp-fc130e699774228f396dc6f4fef4b654edc00451.tar.gz
otp-fc130e699774228f396dc6f4fef4b654edc00451.tar.bz2
otp-fc130e699774228f396dc6f4fef4b654edc00451.zip
Fix shell crash when in switch command mode
The user_drv process can crash if ctrl-y is pressed when in switch command mode (ctrl-g). This is due to switch mode using edlin to parse the input. And edlin uses the process dictionary to store the kill_buffer. However the kill_buffer is undefined if not initialized by edlin:init/0 which makes the user_drv process crash since edlin is calling list:reverse/2 with undefined. Fix calles edlin:init/0 once before server_loop is entered.
Diffstat (limited to 'lib/kernel/src/user_drv.erl')
-rw-r--r--lib/kernel/src/user_drv.erl4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/kernel/src/user_drv.erl b/lib/kernel/src/user_drv.erl
index e6ce85c379..f7b2be1ca3 100644
--- a/lib/kernel/src/user_drv.erl
+++ b/lib/kernel/src/user_drv.erl
@@ -133,6 +133,10 @@ server1(Iport, Oport, Shell) ->
flatten(io_lib:format("~ts\n",
[erlang:system_info(system_version)]))},
Iport, Oport),
+
+ %% Init edlin used by switch command
+ edlin:init(),
+
%% Enter the server loop.
server_loop(Iport, Oport, Curr, User, Gr, queue:new()).