rdiff-backup-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [rdiff-backup-users] Building rdiff-backup on Windows


From: Josh Nisly
Subject: Re: [rdiff-backup-users] Building rdiff-backup on Windows
Date: Tue, 08 Apr 2008 07:31:32 -0500
User-agent: Thunderbird 2.0.0.12 (X11/20080227)

Andrew Ferguson wrote:

@@ -46,6 +48,7 @@
/* This code taken from Python's posixmodule.c */
#undef STAT
#if defined(MS_WIN64) || defined(MS_WIN32)
+#  define lstat _stati64
#    define STAT _stati64
#    define FSTAT _fstati64
#    define STRUCT_STAT struct _stati64
@@ -69,6 +72,16 @@
#define S_ISFIFO(mode)        (((mode) & S_IFMT) == S_IFIFO)
#endif

Ah, good catch, but what we should do is change the calls to 'lstat' in the body of cmodule.c to be calls to LSTAT and then make that block:
Attached is an updated version of the patch.

Thanks,
JoshN
--- cmodule.c   2008-01-03 09:36:48.000000000 -0600
+++ cmodule.c   2008-04-08 00:10:37.390625000 -0500
@@ -24,7 +24,9 @@
 #include <Python.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#if !defined(MS_WIN64) && !defined(MS_WIN32)
 #include <unistd.h>
+#endif
 #include <errno.h>
 
 
@@ -46,13 +48,17 @@
 /* This code taken from Python's posixmodule.c */
 #undef STAT
 #if defined(MS_WIN64) || defined(MS_WIN32)
+#      define LSTAT _stati64
 #      define STAT _stati64
 #      define FSTAT _fstati64
 #      define STRUCT_STAT struct _stati64
+#      define SYNC _flushall
 #else
+#      define LSTAT lstat
 #      define STAT stat
 #      define FSTAT fstat
 #      define STRUCT_STAT struct stat
+#      define SYNC sync
 #endif
 #ifndef PY_LONG_LONG 
     #define PY_LONG_LONG LONG_LONG 
@@ -69,6 +75,15 @@
 #define S_ISFIFO(mode)        (((mode) & S_IFMT) == S_IFIFO)
 #endif
 
+#if defined(MS_WIN64) || defined(MS_WIN32)
+#define S_ISSOCK(mode) (0)
+#define S_ISFIFO(mode) (0)
+#define S_ISLNK(mode) (0)
+#define S_ISLNK(mode) (0)
+#define S_ISCHR(mode) (0)
+#define S_ISBLK(mode) (0)
+#endif
+
 static PyObject *UnknownFileTypeError;
 static PyObject *c_make_file_dict(PyObject *self, PyObject *args);
 static PyObject *long2str(PyObject *self, PyObject *args);
@@ -90,7 +105,7 @@
   if (!PyArg_ParseTuple(args, "s", &filename)) return NULL;
 
   Py_BEGIN_ALLOW_THREADS
-  res = lstat(filename, &sbuf);
+  res = LSTAT(filename, &sbuf);
   Py_END_ALLOW_THREADS
 
   if (res != 0) {
@@ -225,7 +240,7 @@
         PyObject *args;
 {
   if (!PyArg_ParseTuple(args, "")) return NULL;
-  sync();
+  SYNC();
   return Py_BuildValue("");
 }
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]