ioctl() was not setting the correct errno value, which is used to signal
non-error events as well. This fixes listing problems, and clone.