summaryrefslogtreecommitdiff
path: root/lib/tftp/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tftp/src')
-rw-r--r--lib/tftp/src/Makefile4
-rw-r--r--lib/tftp/src/tftp.erl6
-rw-r--r--lib/tftp/src/tftp_binary.erl12
-rw-r--r--lib/tftp/src/tftp_engine.erl12
-rw-r--r--lib/tftp/src/tftp_file.erl22
-rw-r--r--lib/tftp/src/tftp_lib.erl6
6 files changed, 31 insertions, 31 deletions
diff --git a/lib/tftp/src/Makefile b/lib/tftp/src/Makefile
index 4ece9ffe28..cfcb1ea134 100644
--- a/lib/tftp/src/Makefile
+++ b/lib/tftp/src/Makefile
@@ -1,7 +1,7 @@
#
# %CopyrightBegin%
#
-# Copyright Ericsson AB 2005-2021. All Rights Reserved.
+# Copyright Ericsson AB 2005-2022. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -80,7 +80,7 @@ ERL_COMPILE_FLAGS += \
$(TARGET_FILES): $(BEHAVIOUR_TARGET_FILES)
-debug opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET)
+$(TYPES): $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET)
clean:
rm -f $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) $(BEHAVIOUR_TARGET_FILES)
diff --git a/lib/tftp/src/tftp.erl b/lib/tftp/src/tftp.erl
index 31e4c651e8..a32d0dca9c 100644
--- a/lib/tftp/src/tftp.erl
+++ b/lib/tftp/src/tftp.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2018. All Rights Reserved.
+%% Copyright Ericsson AB 2005-2022. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -79,7 +79,7 @@
%%% setuid_socket_wrap. Then the command line argument
%%% "-tftpd_69 22" will trigger the prebound file
%%% descriptor 22 to be used instead of opening port 69.
-%%% The UDP option {udp, [{fd, 22}]} autmatically be added.
+%%% The UDP option {udp, [{fd, 22}]} automatically be added.
%%% See init:get_argument/ about command line arguments and
%%% gen_udp:open/2 about UDP options.
%%%
@@ -107,7 +107,7 @@
%%% usage is when used in conjunction with setuid_socket_wrap
%%% to be able to open privileged sockets. For example if the
%%% file descriptor 22 has been opened by setuid_socket_wrap
-%%% and you have choosen my_tftp_fd as init argument, the
+%%% and you have chosen my_tftp_fd as init argument, the
%%% command line should like this "erl -my_tftp_fd 22" and
%%% FileDesc should be set to my_tftpd_fd. This would
%%% automatically imply {fd, 22} to be set as UDP option.
diff --git a/lib/tftp/src/tftp_binary.erl b/lib/tftp/src/tftp_binary.erl
index 3438ba235b..dda64b4252 100644
--- a/lib/tftp/src/tftp_binary.erl
+++ b/lib/tftp/src/tftp_binary.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2018. All Rights Reserved.
+%% Copyright Ericsson AB 2005-2023. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -53,7 +53,7 @@ prepare(_Peer, Access, Filename, Mode, SuggestedOptions, Initial) when is_list(I
blksize = lookup_blksize(AcceptedOptions),
bin = Filename,
is_network_ascii = IsNetworkAscii,
- count = size(Filename),
+ count = byte_size(Filename),
is_native_ascii = IsNativeAscii},
{ok, AcceptedOptions, State};
{ok, IsNetworkAscii, AcceptedOptions} when Access =:= write, Filename =:= binary ->
@@ -115,11 +115,11 @@ open(Peer, Access, Filename, Mode, NegotiatedOptions, State) ->
read(#read_state{bin = Bin} = State) when is_binary(Bin) ->
BlkSize = State#read_state.blksize,
if
- size(Bin) >= BlkSize ->
+ byte_size(Bin) >= BlkSize ->
<<Block:BlkSize/binary, Bin2/binary>> = Bin,
State2 = State#read_state{bin = Bin2},
{more, Block, State2};
- size(Bin) < BlkSize ->
+ byte_size(Bin) < BlkSize ->
{last, Bin, State#read_state.count}
end;
read(State) ->
@@ -132,7 +132,7 @@ read(State) ->
%%-------------------------------------------------------------------
write(Bin, #write_state{list = List} = State) when is_binary(Bin), is_list(List) ->
- Size = size(Bin),
+ Size = byte_size(Bin),
BlkSize = State#write_state.blksize,
if
Size =:= BlkSize ->
@@ -182,7 +182,7 @@ do_handle_options(Access, Bin, [{Key, Val} | T]) ->
"tsize" ->
case Access of
read when Val =:= "0", is_binary(Bin) ->
- Tsize = integer_to_list(size(Bin)),
+ Tsize = integer_to_list(byte_size(Bin)),
[{Key, Tsize} | do_handle_options(Access, Bin, T)];
_ ->
handle_integer(Access, Bin, Key, Val, T, 0, infinity)
diff --git a/lib/tftp/src/tftp_engine.erl b/lib/tftp/src/tftp_engine.erl
index 811f91b8bd..f9e5e40d34 100644
--- a/lib/tftp/src/tftp_engine.erl
+++ b/lib/tftp/src/tftp_engine.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2021. All Rights Reserved.
+%% Copyright Ericsson AB 2005-2023. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -1001,7 +1001,7 @@ do_callback(read = Fun, Config, Callback, Req)
NextBlockNo = Callback#callback.block_no + 1,
case catch safe_apply(Callback#callback.module, Fun, Args) of
{more, Bin, NewState} when is_binary(Bin) ->
- Count = Callback#callback.count + size(Bin),
+ Count = Callback#callback.count + byte_size(Bin),
Callback2 = Callback#callback{state = NewState,
block_no = NextBlockNo,
count = Count},
@@ -1035,7 +1035,7 @@ do_callback({write = Fun, Bin}, Config, Callback, Req)
NextBlockNo = Callback#callback.block_no + 1,
case catch safe_apply(Callback#callback.module, Fun, Args) of
{more, NewState} ->
- Count = Callback#callback.count + size(Bin),
+ Count = Callback#callback.count + byte_size(Bin),
Callback2 = Callback#callback{state = NewState,
block_no = NextBlockNo,
count = Count},
@@ -1112,9 +1112,9 @@ do_callback({abort, Error}, _Config, undefined, _Req) when is_record(Error, tftp
peer_info(#config{udp_host = Host, udp_port = Port}) ->
if
- is_tuple(Host), size(Host) =:= 4 ->
+ tuple_size(Host) =:= 4 ->
{inet, tftp_lib:host_to_string(Host), Port};
- is_tuple(Host), size(Host) =:= 8 ->
+ tuple_size(Host) =:= 8 ->
{inet6, tftp_lib:host_to_string(Host), Port};
true ->
{undefined, Host, Port}
@@ -1336,7 +1336,7 @@ print_debug_info(#config{debug_level = Level} = Config, Who, Where, Data) ->
end.
do_print_debug_info(Config, Who, Where, #tftp_msg_data{data = Bin} = Msg) when is_binary(Bin) ->
- Msg2 = Msg#tftp_msg_data{data = {bytes, size(Bin)}},
+ Msg2 = Msg#tftp_msg_data{data = {bytes, byte_size(Bin)}},
do_print_debug_info(Config, Who, Where, Msg2);
do_print_debug_info(Config, Who, Where, #tftp_msg_req{local_filename = Filename} = Msg) when is_binary(Filename) ->
Msg2 = Msg#tftp_msg_req{local_filename = binary},
diff --git a/lib/tftp/src/tftp_file.erl b/lib/tftp/src/tftp_file.erl
index 5922fc9418..b6fb97bfb5 100644
--- a/lib/tftp/src/tftp_file.erl
+++ b/lib/tftp/src/tftp_file.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2018. All Rights Reserved.
+%% Copyright Ericsson AB 2005-2023. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -67,7 +67,7 @@
%% PeerType = inet | inet6
%% PeerHost = ip_address()
%% PeerPort = integer()
-%% Acess = read | write
+%% Access = read | write
%% Filename = string()
%% Mode = string()
%% SuggestedOptions = [{Key, Value}]
@@ -118,7 +118,7 @@ prepare(_Peer, Access, Filename, Mode, SuggestedOptions, Initial) when is_list(I
%% PeerType = inet | inet6
%% PeerHost = ip_address()
%% PeerPort = integer()
-%% Acess = read | write
+%% Access = read | write
%% Filename = string()
%% Mode = string()
%% SuggestedOptions = [{Key, Value}]
@@ -135,10 +135,10 @@ prepare(_Peer, Access, Filename, Mode, SuggestedOptions, Initial) when is_list(I
%%
%% Opens a file for read or write access.
%%
-%% On the client side where the open/4 call has been preceeded by a
+%% On the client side where the open/4 call has been preceded by a
%% call to prepare/4, all options must be accepted or rejected.
-%% On the server side, where there are no preceeding prepare/4 call,
-%% noo new options may be added, but the ones that are present as
+%% On the server side, where there are no preceding prepare/4 call,
+%% no new options may be added, but the ones that are present as
%% SuggestedOptions may be omitted or replaced with new values
%% in the AcceptedOptions.
%%-------------------------------------------------------------------
@@ -211,12 +211,12 @@ file_error(Reason) when is_atom(Reason) ->
read(#state{access = read} = State) ->
BlkSize = State#state.blksize,
case file:read(State#state.fd, BlkSize) of
- {ok, Bin} when is_binary(Bin), size(Bin) =:= BlkSize ->
- Count = State#state.count + size(Bin),
+ {ok, Bin} when is_binary(Bin), byte_size(Bin) =:= BlkSize ->
+ Count = State#state.count + byte_size(Bin),
{more, Bin, State#state{count = Count}};
- {ok, Bin} when is_binary(Bin), size(Bin) < BlkSize ->
+ {ok, Bin} when is_binary(Bin), byte_size(Bin) < BlkSize ->
_ = file:close(State#state.fd),
- Count = State#state.count + size(Bin),
+ Count = State#state.count + byte_size(Bin),
{last, Bin, Count};
eof ->
{last, <<>>, State#state.count};
@@ -248,7 +248,7 @@ read(State) ->
%%-------------------------------------------------------------------
write(Bin, #state{access = write} = State) when is_binary(Bin) ->
- Size = size(Bin),
+ Size = byte_size(Bin),
BlkSize = State#state.blksize,
case file:write(State#state.fd, Bin) of
ok when Size =:= BlkSize->
diff --git a/lib/tftp/src/tftp_lib.erl b/lib/tftp/src/tftp_lib.erl
index 407a273f58..7c55462c48 100644
--- a/lib/tftp/src/tftp_lib.erl
+++ b/lib/tftp/src/tftp_lib.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2018. All Rights Reserved.
+%% Copyright Ericsson AB 2005-2023. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -94,9 +94,9 @@ do_parse_config([{Key, Val} | Tail], Config) when is_record(Config, config) ->
if
is_list(Val) ->
do_parse_config(Tail, Config#config{udp_host = Val});
- is_tuple(Val), size(Val) =:= 4 ->
+ tuple_size(Val) =:= 4 ->
do_parse_config(Tail, Config#config{udp_host = Val});
- is_tuple(Val), size(Val) =:= 8 ->
+ tuple_size(Val) =:= 8 ->
do_parse_config(Tail, Config#config{udp_host = Val});
true ->
exit({badarg, {Key, Val}})