24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-07-04 23:15:31 +02:00

"epam" should return binaries, not strings

This commit is contained in:
Evgeniy Khramtsov 2012-10-24 18:09:11 +10:00
parent 3ef6e4c834
commit 3be9c27509

View File

@ -154,6 +154,7 @@ static int write_cmd(char *buf, int len)
static int process_reply(ETERM *pid, int cmd, int res) static int process_reply(ETERM *pid, int cmd, int res)
{ {
ETERM *result; ETERM *result;
ETERM *errbin;
int len, retval; int len, retval;
const char *errtxt; const char *errtxt;
byte *buf; byte *buf;
@ -162,7 +163,9 @@ static int process_reply(ETERM *pid, int cmd, int res)
else else
{ {
errtxt = pam_strerror(NULL, res); errtxt = pam_strerror(NULL, res);
result = erl_format("{~i, ~w, {false, ~s}}", cmd, pid, errtxt); errbin = erl_mk_binary(errtxt, strlen(errtxt));
result = erl_format("{~i, ~w, {false, ~w}}", cmd, pid, errbin);
erl_free_term(errbin);
} }
len = erl_term_len(result); len = erl_term_len(result);
buf = erl_malloc(len); buf = erl_malloc(len);