~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-10-22 17:08:00 UTC
  • mfrom: (2922.1.2 binary_read_153493)
  • Revision ID: pqm@pqm.ubuntu.com-20071022170800-egprunbmf7j0hkvm
(John Arbash Meinel, Alexander Belchenko) Fix bug #153493, use O_BINARY when reading files to compute sha1 sum.

Show diffs side-by-side

added added

removed removed

Lines of Context:
593
593
def sha_file_by_name(fname):
594
594
    """Calculate the SHA1 of a file by reading the full text"""
595
595
    s = sha.new()
596
 
    f = os.open(fname, os.O_RDONLY)
 
596
    f = os.open(fname, os.O_RDONLY | O_BINARY)
597
597
    try:
598
598
        while True:
599
599
            b = os.read(f, 1<<16)