Fixes error handling on ioctl calls.