Commit ae16322b authored by ben's avatar ben

Backed out stat64 code in previous diff, kept thread code


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@195 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent d7aeb5a9
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
# define STRUCT_STAT struct stat # define STRUCT_STAT struct stat
#endif #endif
extern int lstat(const char *, struct stat *);
static PyObject *UnknownFileTypeError; static PyObject *UnknownFileTypeError;
static PyObject *c_make_file_dict(PyObject *self, PyObject *args); static PyObject *c_make_file_dict(PyObject *self, PyObject *args);
...@@ -47,25 +48,21 @@ static PyObject *c_make_file_dict(self, args) ...@@ -47,25 +48,21 @@ static PyObject *c_make_file_dict(self, args)
{ {
PyObject *size, *inode, *mtime, *atime, *devloc, *return_val; PyObject *size, *inode, *mtime, *atime, *devloc, *return_val;
char *filename, filetype[5]; char *filename, filetype[5];
STRUCT_STAT sbuf; struct stat sbuf;
long int mode, perms; long int mode, perms;
int res; int res;
if (!PyArg_ParseTuple(args, "s", &filename)) return NULL; if (!PyArg_ParseTuple(args, "s", &filename)) return NULL;
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
#if HAVE_LARGEFILE_SUPPORT
res = lstat64(filename, &sbuf);
#else
res = lstat(filename, &sbuf); res = lstat(filename, &sbuf);
#endif
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
if (res != 0) { if (res != 0) {
if (errno == ENOENT || errno == ENOTDIR) if (errno == ENOENT || errno == ENOTDIR)
return Py_BuildValue("{s:s}", "type", NULL); return Py_BuildValue("{s:s}", "type", NULL);
else { else {
PyErr_SetFromErrno(PyExc_OSError); PyErr_SetFromErrnoWithFilename(PyExc_OSError, filename);
return NULL; return NULL;
} }
} }
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
# define STRUCT_STAT struct stat # define STRUCT_STAT struct stat
#endif #endif
extern int lstat(const char *, struct stat *);
static PyObject *UnknownFileTypeError; static PyObject *UnknownFileTypeError;
static PyObject *c_make_file_dict(PyObject *self, PyObject *args); static PyObject *c_make_file_dict(PyObject *self, PyObject *args);
...@@ -47,25 +48,21 @@ static PyObject *c_make_file_dict(self, args) ...@@ -47,25 +48,21 @@ static PyObject *c_make_file_dict(self, args)
{ {
PyObject *size, *inode, *mtime, *atime, *devloc, *return_val; PyObject *size, *inode, *mtime, *atime, *devloc, *return_val;
char *filename, filetype[5]; char *filename, filetype[5];
STRUCT_STAT sbuf; struct stat sbuf;
long int mode, perms; long int mode, perms;
int res; int res;
if (!PyArg_ParseTuple(args, "s", &filename)) return NULL; if (!PyArg_ParseTuple(args, "s", &filename)) return NULL;
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
#if HAVE_LARGEFILE_SUPPORT
res = lstat64(filename, &sbuf);
#else
res = lstat(filename, &sbuf); res = lstat(filename, &sbuf);
#endif
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
if (res != 0) { if (res != 0) {
if (errno == ENOENT || errno == ENOTDIR) if (errno == ENOENT || errno == ENOTDIR)
return Py_BuildValue("{s:s}", "type", NULL); return Py_BuildValue("{s:s}", "type", NULL);
else { else {
PyErr_SetFromErrno(PyExc_OSError); PyErr_SetFromErrnoWithFilename(PyExc_OSError, filename);
return NULL; return NULL;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment