From fc130e699774228f396dc6f4fef4b654edc00451 Mon Sep 17 00:00:00 2001 From: Jonas Falkevik Date: Fri, 4 Apr 2014 22:17:34 +0200 Subject: 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. --- lib/kernel/src/user_drv.erl | 4 ++++ 1 file changed, 4 insertions(+) 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()). -- cgit v1.2.3