changeset 5398:ecde0b7e0b3f

osutil.c: use readdir instead of readdir64 Some systems (e.g. *BSD) don't have a readdir64 function - the regular readdir already uses 64-bit types. On other systems (Linux, Solaris, ...), if Python was compiled with large file support, Python.h will define _LARGEFILE_SOURCE and _FILE_OFFSET_BITS=64, so that any call to readdir will actually be a call to readdir64. If Python was not compiled with large file support, we probably don't want to define these macros to avoid ABI problems.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sat, 06 Oct 2007 14:14:11 -0300
parents 11caa374f497
children 18f8abefdb2a
files mercurial/osutil.c
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/osutil.c
+++ b/mercurial/osutil.c
@@ -8,7 +8,6 @@
 */
 
 #define _ATFILE_SOURCE
-#define _LARGEFILE64_SOURCE
 #include <Python.h>
 #include <alloca.h>
 #include <dirent.h>
@@ -113,7 +112,7 @@ static inline int mode_to_kind(int mode)
 static PyObject *listdir(PyObject *self, PyObject *args, PyObject *kwargs)
 {
     DIR *dir = NULL;
-    struct dirent64 *ent;
+    struct dirent *ent;
     PyObject *list = NULL;
     PyObject *ctor_args = NULL;
     int all_kinds = 1;
@@ -146,7 +145,7 @@ static PyObject *listdir(PyObject *self,
     memcpy(full_path, path, path_len);
     full_path[path_len] = '/';
 
-    while ((ent = readdir64(dir))) {
+    while ((ent = readdir(dir))) {
         PyObject *name = NULL;
         PyObject *py_kind = NULL;
         PyObject *val = NULL;