Added error check to ioctl winsize