Revision 634a9a35

b/tools/setup-ssh
137 137

  
138 138
  authorized_keys = sftp.open(auth_keys, "a+")
139 139
  try:
140
    # Due to the way SFTPFile and BufferedFile are implemented,
141
    # opening in a+ mode and then issuing a read(), readline() or
142
    # iterating over the file (which uses read() internally) will see
143
    # an empty file, since the paramiko internal file position and the
144
    # OS-level file-position are desynchronized; therefore, we issue
145
    # an explicit seek to resynchronize these; writes should (note
146
    # should) still go to the right place
147
    authorized_keys.seek(0, 0)
140 148
    # We don't have to close, as the close happened already in AddAuthorizedKey
141 149
    utils.AddAuthorizedKey(authorized_keys, filemap[pub_key][0])
142 150
  finally:

Also available in: Unified diff