Need to check e.errno instead of os.errno. Fixes #8548