Handle the case where the ioctl returns sizes == 0

This occurs in emacs shell buffers, for example, which don't report anything useful for size.