# File lib/openid/filestore.rb, line 96
    def storeAssociation(association)
      assoc_s = OpenID::ConsumerAssociation.serialize(association)
      filename = getAssociationFilename(association.server_url)
      f, tmp = mktemp
    
      begin
        begin
          f.write(assoc_s)
          f.fsync
        ensure
          f.close
        end
        
        begin
          File.rename(tmp, filename)
        rescue Errno::EEXIST
        
          begin
            File.unlink(filename)
          rescue Errno::ENOENT
            # do nothing
          end
          
          File.rename(tmp, filename)
        end
        
      rescue
        self.removeIfPresent(tmp)
        raise
      end
    end