diff options
| author | Matthew Sackman <matthew@rabbitmq.com> | 2010-05-25 11:42:32 +0100 |
|---|---|---|
| committer | Matthew Sackman <matthew@rabbitmq.com> | 2010-05-25 11:42:32 +0100 |
| commit | 0e00781c73b3b639b5095730d84ab1cea8507d7f (patch) | |
| tree | eef57a9b01434af145f1e80284a6e049ad506de0 | |
| parent | 046c061480839e06cf10b5ea9d7e97545fc67ac8 (diff) | |
| parent | 865ddf4538f5f35e430e301a02085d127a8cf1e1 (diff) | |
| download | rabbitmq-server-git-0e00781c73b3b639b5095730d84ab1cea8507d7f.tar.gz | |
Merging bug 22774 onto default
| -rw-r--r-- | src/rabbit_misc.erl | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index 723b818b41..9a911ab15d 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -537,18 +537,24 @@ pid_to_string(Pid) when is_pid(Pid) -> %% inverse of above string_to_pid(Str) -> + Err = {error, {invalid_pid_syntax, Str}}, %% The \ before the trailing $ is only there to keep emacs %% font-lock from getting confused. case re:run(Str, "^<(.*)\\.([0-9]+)\\.([0-9]+)>\$", [{capture,all_but_first,list}]) of {match, [NodeStr, IdStr, SerStr]} -> - %% turn the triple into a pid - see pid_to_string - <<131,NodeEnc/binary>> = term_to_binary(list_to_atom(NodeStr)), + %% the NodeStr atom might be quoted, so we have to parse + %% it rather than doing a simple list_to_atom + NodeAtom = case erl_scan:string(NodeStr) of + {ok, [{atom, _, X}], _} -> X; + {error, _, _} -> throw(Err) + end, + <<131,NodeEnc/binary>> = term_to_binary(NodeAtom), Id = list_to_integer(IdStr), Ser = list_to_integer(SerStr), binary_to_term(<<131,103,NodeEnc/binary,Id:32,Ser:32,0:8>>); nomatch -> - throw({error, {invalid_pid_syntax, Str}}) + throw(Err) end. version_compare(A, B, lte) -> |
