summaryrefslogtreecommitdiff
path: root/rdiff-backup/rdiff_backup/cmodule.c
diff options
context:
space:
mode:
authorben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-09-10 22:18:36 +0000
committerben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-09-10 22:18:36 +0000
commitda17a03c192fb2668a32ca222862a38d9b934dd5 (patch)
treeba858327f73aa4785ead3cdac772f1792183e50d /rdiff-backup/rdiff_backup/cmodule.c
parent1393b0a06a74b7aab6ce88e7a2aa674c21f5a037 (diff)
downloadrdiff-backup-da17a03c192fb2668a32ca222862a38d9b934dd5.tar.gz
Added thread statements and lstat64 check for large file support
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@193 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/rdiff_backup/cmodule.c')
-rw-r--r--rdiff-backup/rdiff_backup/cmodule.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/rdiff-backup/rdiff_backup/cmodule.c b/rdiff-backup/rdiff_backup/cmodule.c
index 9d8c62b..f76d73e 100644
--- a/rdiff-backup/rdiff_backup/cmodule.c
+++ b/rdiff-backup/rdiff_backup/cmodule.c
@@ -19,6 +19,20 @@
#include <Python.h>
#include <errno.h>
+/* choose the appropriate stat and fstat functions and return structs */
+/* This code taken from Python's posixmodule.c */
+#undef STAT
+#if defined(MS_WIN64) || defined(MS_WIN32)
+# define STAT _stati64
+# define FSTAT _fstati64
+# define STRUCT_STAT struct _stati64
+#else
+# define STAT stat
+# define FSTAT fstat
+# define STRUCT_STAT struct stat
+#endif
+
+
static PyObject *UnknownFileTypeError;
static PyObject *c_make_file_dict(PyObject *self, PyObject *args);
static PyObject *long2str(PyObject *self, PyObject *args);
@@ -33,11 +47,21 @@ static PyObject *c_make_file_dict(self, args)
{
PyObject *size, *inode, *mtime, *atime, *devloc, *return_val;
char *filename, filetype[5];
- struct stat sbuf;
+ STRUCT_STAT sbuf;
long int mode, perms;
+ int res;
if (!PyArg_ParseTuple(args, "s", &filename)) return NULL;
- if (lstat(filename, &sbuf) != 0) {
+
+ Py_BEGIN_ALLOW_THREADS
+#if HAVE_LARGEFILE_SUPPORT
+ res = lstat64(filename, &sbuf);
+#else
+ res = lstat(filename, &sbuf);
+#endif
+ Py_END_ALLOW_THREADS
+
+ if (res != 0) {
if (errno == ENOENT || errno == ENOTDIR)
return Py_BuildValue("{s:s}", "type", NULL);
else {