Prevent EINVAL in setsockopt

Several values are required to be ints rather than longs
but are not included in the if statement.