Ignore:
Timestamp:
Sep 19, 2011 2:30:34 PM (8 years ago)
Author:
Ted Faber <faber@…>
Branches:
compt_changes, info-ops, master
Children:
4157521
Parents:
5f51dc1
Message:

Make sure copy does not erase files if src and dest are the same

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/authorizer.py

    r5f51dc1 ra55f2f9  
    461461        Copy src to dest with file mode mode.  May raise exceptions on file ops
    462462        '''
    463         d = open(dest, 'w')
    464         s = open(src, 'r')
    465         d.write(s.read())
    466         s.close()
    467         d.close()
     463
     464        if dest != src:
     465            d = open(dest, 'w')
     466            s = open(src, 'r')
     467            d.write(s.read())
     468            s.close()
     469            d.close()
    468470        os.chmod(dest, mode)
    469471
Note: See TracChangeset for help on using the changeset viewer.