You can't return errno here, this function is also executed on Windows, so the error would need to be translated.