aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/erl_distribution_wb_SUITE.erl
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2017-10-16 18:01:20 +0200
committerSverker Eriksson <[email protected]>2017-10-17 15:26:21 +0200
commit6a6019c287a54b71d4d0bcf0a72d244d89de90d1 (patch)
treed82f2b10b03f932c8efc9533335c2e7b7e984198 /lib/kernel/test/erl_distribution_wb_SUITE.erl
parent890fb3bc90cdab64506cd4a43ca0a04727b5b7ea (diff)
downloadotp-6a6019c287a54b71d4d0bcf0a72d244d89de90d1.tar.gz
otp-6a6019c287a54b71d4d0bcf0a72d244d89de90d1.tar.bz2
otp-6a6019c287a54b71d4d0bcf0a72d244d89de90d1.zip
kernel: Fix erl_distribution_wb_SUITE
to use binary_to_term/2 with 'used' option and not rely on term_to_binary generating the same format.
Diffstat (limited to 'lib/kernel/test/erl_distribution_wb_SUITE.erl')
-rw-r--r--lib/kernel/test/erl_distribution_wb_SUITE.erl8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/kernel/test/erl_distribution_wb_SUITE.erl b/lib/kernel/test/erl_distribution_wb_SUITE.erl
index 03aaee56b7..258ed4f88c 100644
--- a/lib/kernel/test/erl_distribution_wb_SUITE.erl
+++ b/lib/kernel/test/erl_distribution_wb_SUITE.erl
@@ -65,6 +65,7 @@
?DFLAG_EXTENDED_PIDS_PORTS bor
?DFLAG_UTF8_ATOMS)).
+-define(PASS_THROUGH, $p).
-define(shutdown(X), exit(X)).
-define(int16(X), [((X) bsr 8) band 16#ff, (X) band 16#ff]).
@@ -676,10 +677,9 @@ recv_message(Socket) ->
case gen_tcp:recv(Socket, 0) of
{ok,Data} ->
B0 = list_to_binary(Data),
- {_,B1} = erlang:split_binary(B0,1),
- Header = binary_to_term(B1),
- Siz = byte_size(term_to_binary(Header)),
- {_,B2} = erlang:split_binary(B1,Siz),
+ <<?PASS_THROUGH, B1/binary>> = B0,
+ {Header,Siz} = binary_to_term(B1,[used]),
+ <<_:Siz/binary,B2/binary>> = B1,
Message = case (catch binary_to_term(B2)) of
{'EXIT', _} ->
could_not_digest_message;