~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_readdir_pyx.pyx

  • Committer: Martin Pool
  • Date: 2008-10-07 06:02:24 UTC
  • mto: This revision was merged to the branch mainline in revision 3767.
  • Revision ID: mbp@sourcefrog.net-20081007060224-dgbg7gof5blx2450
We need a 'global' declaration to assign to errno; and fix comments

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    pass
26
26
 
27
27
 
28
 
# the opaque C library DIR type.
29
28
cdef extern from 'errno.h':
30
29
    int ENOENT
31
30
    int ENOTDIR
32
31
    int EAGAIN
33
32
    int EINTR
 
33
    char *strerror(int errno)
 
34
    # not necessarily a real variable, but this should be close enough
34
35
    int errno
35
 
    char *strerror(int errno)
36
36
 
37
37
cdef extern from 'unistd.h':
38
38
    int chdir(char *path)
90
90
    ctypedef struct dirent:
91
91
        char d_name[256]
92
92
        ino_t d_ino
 
93
    # the opaque C library DIR type.
93
94
    ctypedef struct DIR
94
95
    # should be DIR *, pyrex barfs.
95
96
    DIR * opendir(char * name)
279
280
    cdef int stat_result
280
281
    cdef _Stat statvalue
281
282
    cdef char *cwd
 
283
    global errno
282
284
 
283
285
    cwd = getcwd(NULL, 0)
284
286
    if -1 == chdir(path):