The return value of ioctl() should be checked.