ftp.erl

Martin Bjorklund <>
Sun Mar 19 23:38:18 CET 2006


Here's a patch to handle file errors from the FTP server. I don't know
exactly when this happens, but I use the send_chunk* functions.
Without this patch I get:


=ERROR REPORT==== 19-Mar-2006::23:19:30 ===
** Generic server <0.174.0> terminating 
** Last message in was {tcp,#Port<0.245>,
                            <<"553 Permission denied!
">>}
** When Server state == {state,#Port<0.245>,
                               {lsock,#Port<0.247>},
                               false,
                               "/home/mbj/src/tailf-src/trunk",
                               ftp_server_default,
                               false,
                               active,
                               60000,
                               <<"">>,
                               {<<"">>,[],start},
                               <0.158.0>,
                               {<0.158.0>,#Ref<0.0.0.858>},
                               start_chunk_transfer,
                               false,
                               ignore}
** Reason for termination == 
** {bad_return_value,{stop,normal,
                           {error,efnamena},
                           {state,#Port<0.245>,
                                  {lsock,#Port<0.247>},
                                  false,
                                  "/home/mbj/src/tailf-src/trunk",
                                  ftp_server_default,
                                  false,
                                  active,
                                  60000,
                                  <<"">>,
                                  {<<"">>,[],start},
                                  <0.158.0>,
                                  undefined,
                                  start_chunk_transfer,
                                  false,
                                  ignore}}}




And the simple patch:


nassa ftp> diff -C2  ftp.erl /home/mbj/src/tailf-src/trunk/otp/lib/inets/src/ftp/ftp.erl 
*** ftp.erl     Wed Oct 12 17:17:36 2005
--- /home/mbj/src/tailf-src/trunk/otp/lib/inets/src/ftp/ftp.erl Sun Mar 19 23:33:58 2006
***************
*** 1224,1228 ****
  %Status == etnospc; Status == epnospc; Status == econn ->
      gen_server:reply(From, {error, Status}),
!     {stop, normal, {error, Status}, State#state{client = undefined}};
  
  ctrl_result_response(_, #state{client = From} = State, ErrorMsg) ->
--- 1224,1228 ----
  %Status == etnospc; Status == epnospc; Status == econn ->
      gen_server:reply(From, {error, Status}),
!     {stop, normal, State#state{client = undefined}};
  
  ctrl_result_response(_, #state{client = From} = State, ErrorMsg) ->



More information about the erlang-patches mailing list