zmq_sys::ZMQ_RCVMORE returns a c_int #393
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
zmq_getsockopt with the option ZMQ_RCVMORE returns an 'int' value. However, get_rcvmore interpreted the result as an i64. While this is technically wrong in case c_int is 32 bit wide, it seems to still work in most cases, as the bit representation of 1i32 and 1i64 is identical on little-endian systems.
However, on big-endian systems, it fails. This can be reproduced on the debian s390x port, where
cargo test
fails with:To fix this,
get_rcvmore
should interpret the return value as ani32
.(Technically,
c_int
would be more correct thani32
. But the getter generated bygetsockopt_num!(c_int, i32)
insrc/sockopt.rs
already mapsc_int
toi32
. This may be an issue on systems wherec_int
is a 16 bit value. But I doubt zmq will be used on such a system in practice.)