easier err handling for getsockopt