aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_interface/src/decode/decode_port.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2015-11-13 16:50:33 +0100
committerSverker Eriksson <[email protected]>2016-04-07 18:41:47 +0200
commit9c80b9ec06fc0ca89dcc8d797a2dbc408a162098 (patch)
tree00920702806a31febc140ebca3850622a93836ff /lib/erl_interface/src/decode/decode_port.c
parentbf0bf9cf009fa8ccc7fc364fdbbdeb6f491efe43 (diff)
downloadotp-9c80b9ec06fc0ca89dcc8d797a2dbc408a162098.tar.gz
otp-9c80b9ec06fc0ca89dcc8d797a2dbc408a162098.tar.bz2
otp-9c80b9ec06fc0ca89dcc8d797a2dbc408a162098.zip
erl_interface: Support 32-bit creation for pid,port,refs
Diffstat (limited to 'lib/erl_interface/src/decode/decode_port.c')
-rw-r--r--lib/erl_interface/src/decode/decode_port.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/erl_interface/src/decode/decode_port.c b/lib/erl_interface/src/decode/decode_port.c
index e039b5b845..7b61f254ff 100644
--- a/lib/erl_interface/src/decode/decode_port.c
+++ b/lib/erl_interface/src/decode/decode_port.c
@@ -26,17 +26,21 @@ int ei_decode_port(const char *buf, int *index, erlang_port *p)
{
const char *s = buf + *index;
const char *s0 = s;
+ const char tag = get8(s);
- if (get8(s) != ERL_PORT_EXT) return -1;
+ if (tag != ERL_PORT_EXT && tag != ERL_NEW_PORT_EXT) return -1;
if (p) {
if (get_atom(&s, p->node, NULL) < 0) return -1;
p->id = get32be(s) & 0x0fffffff /* 28 bits */;
- p->creation = get8(s) & 0x03;
+ if (tag == ERL_PORT_EXT)
+ p->creation = get8(s) & 0x03;
+ else
+ p->creation = get32be(s);
}
else {
if (get_atom(&s, NULL, NULL) < 0) return -1;
- s += 5;
+ s += (tag == ERL_PORT_EXT ? 5 : 8);
}
*index += s-s0;