This condition is never true: MSG_NOSIGNAL is always defined because of the lines 58-60.

Lines 58-60 should be after this test.