Dodgy implementation of error-based errno
Is EINVAL always 22?
Try re-enabling calloc
Try enabling one use of errno