Catch OSError when checking for permissions