# File lib/openid/filestore.rb, line 102
    def store_association(server_url, association)
      assoc_s = OpenID::Association.serialize(association)
      filename = get_association_filename(server_url, association.handle)
      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.remove_if_present(tmp)
        raise
      end
    end