On 01/03/2013 02:02 AM, Nickolai Zeldovich wrote:
-v |= ((FD_ISSET(k, fds) != 0) j);
+v |= (((abi_ulong) (FD_ISSET(k, fds) != 0)) j);
It would be easier to read if you dropped the unnecessary parens.
v |= (abi_ulong)(FD_ISSET(k, fds) != 0) j;
Otherwise the
On a 64-bit system (e.g., x86_64), copy_to_user_fdset populates the
bitmask returned to the user-space program by left-shifting the value
(FD_ISSET(k, fds) != 0), which is of type int, by k bits (0 through 63).
According to the C standard, left-shifting an int by 31 bits is undefined
behavior