diff options
author | Hans Nilsson <hans@erlang.org> | 2019-11-28 09:50:25 +0100 |
---|---|---|
committer | Hans Nilsson <hans@erlang.org> | 2019-11-28 09:50:25 +0100 |
commit | f0e56779e5d51a1e2a320f8df19d0d37bf4ba084 (patch) | |
tree | ecd929ef3456c1397616011f02e69a5769ca4ea8 | |
parent | 6901bf27ade015c3bb6ff5766d7f71fbec90dd8f (diff) | |
parent | 1338ac70c14597b5075d9f3e141fa06b336cf6e1 (diff) | |
download | erlang-f0e56779e5d51a1e2a320f8df19d0d37bf4ba084.tar.gz |
Merge branch 'hans/tftp/fix_warnings/OTP-16317' into maint
* hans/tftp/fix_warnings/OTP-16317:
tftp: Fix -behaviour warnings
tftp: Fix erlang:get_stacktrace warning
-rw-r--r-- | lib/tftp/src/Makefile | 11 | ||||
-rw-r--r-- | lib/tftp/src/tftp_engine.erl | 13 |
2 files changed, 13 insertions, 11 deletions
diff --git a/lib/tftp/src/Makefile b/lib/tftp/src/Makefile index 602ae845a4..029bd731bd 100644 --- a/lib/tftp/src/Makefile +++ b/lib/tftp/src/Makefile @@ -36,16 +36,16 @@ RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN) # ---------------------------------------------------- # Target Specs # ---------------------------------------------------- -BEHAVIOUR_MODULES= +BEHAVIOUR_MODULES= \ + tftp \ + tftp_logger MODULES = \ - tftp \ tftp_app \ tftp_binary \ tftp_engine \ tftp_file \ tftp_lib \ - tftp_logger \ tftp_sup HRL_FILES = tftp.hrl @@ -69,7 +69,10 @@ APPUP_TARGET= $(EBIN)/$(APPUP_FILE) # ---------------------------------------------------- # FLAGS # ---------------------------------------------------- - +EXTRA_ERLC_FLAGS = +warn_unused_vars +ERL_COMPILE_FLAGS += \ + -pz $(EBIN) \ + $(EXTRA_ERLC_FLAGS) # ---------------------------------------------------- # Targets diff --git a/lib/tftp/src/tftp_engine.erl b/lib/tftp/src/tftp_engine.erl index 78a105bcc8..aeb0b27084 100644 --- a/lib/tftp/src/tftp_engine.erl +++ b/lib/tftp/src/tftp_engine.erl @@ -883,15 +883,14 @@ do_send_msg(#config{udp_socket = Socket, udp_host = RemoteHost, udp_port = Remot %% DumpPath -> %% trace_udp_send(Req, Msg, IoList, DumpPath) %% end, - Res = gen_udp:send(Socket, RemoteHost, RemotePort, IoList), - case Res of - ok -> - ok; - {error, einval = Reason} -> + try + ok = gen_udp:send(Socket, RemoteHost, RemotePort, IoList) + catch + error:{badmatch,{error,einval=Reason}}:StackTrace -> error_msg(Config, "Stacktrace; ~p\n gen_udp:send(~p, ~p, ~p, ~p) -> ~p\n", - [erlang:get_stacktrace(), Socket, RemoteHost, RemotePort, IoList, {error, Reason}]); - {error, Reason} -> + [StackTrace, Socket, RemoteHost, RemotePort, IoList, {error, Reason}]); + error:{badmatch,{error,Reason}} -> {error, Reason} end. |