librpc: Check for negative return value of socket_get_fd()