Commit 67e7e8a2 authored by owsla's avatar owsla

Get cmodule.c building natively on Windows (Patch from Josh Nisly)


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@880 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent c7632087
New in v1.1.16 (????/??/??)
---------------------------
Get cmodule.c building natively on Windows. (Patch from Josh Nisly)
Don't give up right away if we can't open a file. Try chmod'ing it even
if we aren't root or don't own it, since that can sometimes work on AFS
and NFS. Closes Savannah bug #21202. (Andrew Ferguson)
......
......@@ -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 @@ static PyObject *c_make_file_dict(self, args)
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 @@ static PyObject *my_sync(self, args)
PyObject *args;
{
if (!PyArg_ParseTuple(args, "")) return NULL;
sync();
SYNC();
return Py_BuildValue("");
}
......
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