socket_wrapper.c: make FIONREAD handling more robust in swrap_vioctl()