File 0568-ftp-add-missing-case-nlist.patch of Package erlang
From 715ecc531930cb84938ca48c8c371fc64463707c Mon Sep 17 00:00:00 2001
From: Kiko Fernandez-Reyes <kiko@erlang.org>
Date: Mon, 24 Oct 2022 20:08:19 +0200
Subject: [PATCH 1/3] ftp: add missing case nlist
---
lib/ftp/src/ftp.erl | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/lib/ftp/src/ftp.erl b/lib/ftp/src/ftp.erl
index e22a78d9f7..9520580dc7 100644
--- a/lib/ftp/src/ftp.erl
+++ b/lib/ftp/src/ftp.erl
@@ -1773,24 +1773,26 @@ handle_ctrl_result({pos_compl, _}, #state{caller = {handle_dir_result, Dir,
%% %% overhead to be able to give a good return value. Alas not
%% %% all ftp implementations behave the same and returning
%% %% an error string is allowed by the FTP RFC.
- %% case lists:dropwhile(fun(?CR) -> false;(_) -> true end,
- %% binary_to_list(Data)) of
- %% L when (L =:= [?CR, ?LF]) orelse (L =:= []) ->
- %% send_ctrl_message(State, mk_cmd("PWD", [])),
- %% activate_ctrl_connection(State),
- %% {noreply,
- %% State#state{caller = {handle_dir_data, Dir, Data}}};
- %% _ ->
- %% gen_server:reply(From, {ok, Data}),
- %% {noreply, State#state{client = undefined,
- %% caller = undefined}}
- %% end
+ case lists:dropwhile(fun(?CR) -> false;(_) -> true end,
+ binary_to_list(Data)) of
+ L when (L =:= [?CR, ?LF]) orelse (L =:= []) ->
+ _ = send_ctrl_message(State, mk_cmd("PWD", [])),
+ activate_ctrl_connection(State),
+ {noreply,
+ State#state{caller = {handle_dir_data, Dir, Data}}};
+ _ ->
+ gen_server:reply(From, {ok, Data}),
+ {noreply, State#state{client = undefined,
+ caller = undefined}}
+ end
%% </WTF>
- gen_server:reply(From, {ok, Data}),
- {noreply, State#state{client = undefined,
- caller = undefined}}
end;
+handle_ctrl_result({pos_compl, _}=Operation, #state{caller = {handle_dir_result, Dir},
+ data = Data}= State) ->
+ %% operation completed. handle
+ handle_ctrl_result(Operation, State#state{caller = {handle_dir_result, Dir, Data}});
+
handle_ctrl_result({pos_compl, Lines},
#state{caller = {handle_dir_data, Dir, DirData}} =
State0) ->
--
2.35.3