Better to not pass tmp_socket to setsockopt if there was an error here creating the socket.
Redundant code. The if/else block makes more sense than the equivalent in two separate if's.