/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/_readdir_pyx.pyx

  • Committer: Martin Pool
  • Date: 2008-11-21 04:06:25 UTC
  • mto: This revision was merged to the branch mainline in revision 3845.
  • Revision ID: mbp@sourcefrog.net-20081121040625-zvsu9pu1pen8pqfr
Review cleanups on readdir

Show diffs side-by-side

added added

removed removed

Lines of Context:
316
316
                # beforehand so that eof can be distinguished from errors.  See
317
317
                # <https://bugs.launchpad.net/bzr/+bug/279381>
318
318
                while True:
319
 
                    errno = 0;
 
319
                    errno = 0
320
320
                    entry = readdir(the_dir)
321
321
                    if entry == NULL and (errno == EAGAIN or errno == EINTR):
322
322
                        # try again
358
358
                raise OSError(errno, strerror(errno))
359
359
    finally:
360
360
        if -1 != orig_dir_fd:
 
361
            failed = False
361
362
            if -1 == fchdir(orig_dir_fd):
362
 
                raise OSError(errno, strerror(errno))
363
 
            if -1 == close(orig_dir_fd):
 
363
                # try to close the original directory anyhow
 
364
                failed = True
 
365
            if -1 == close(orig_dir_fd) or failed:
364
366
                raise OSError(errno, strerror(errno))
365
367
 
366
368
    return result