default retv of ioctl() should be -NOTTY, instead of -1