Check the success of setsockopt

Static analysis (coverity) reported a defect for not checking
the return from setsockopt.  Put in the check, and log if the
setsockopt fails (unlikely).

Fixes coverity 746751 and 746752