summaryrefslogtreecommitdiff
path: root/_obnammodule.c
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2011-08-30 16:56:02 +0100
committerLars Wirzenius <liw@liw.fi>2011-08-30 16:56:02 +0100
commit583b0de89e3a35ee47210228c3f83cd6b4d8669f (patch)
tree3233e01a6d9c9e994abf16d652346bee2764f7af /_obnammodule.c
parent0dff7242b64569ab56eadf9d3fc2c89f4493e62f (diff)
downloadobnam-583b0de89e3a35ee47210228c3f83cd6b4d8669f.tar.gz
Don't use posix_fadvise if it isn't available.
Diffstat (limited to '_obnammodule.c')
-rw-r--r--_obnammodule.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/_obnammodule.c b/_obnammodule.c
index edd61fcc..65a7242f 100644
--- a/_obnammodule.c
+++ b/_obnammodule.c
@@ -46,6 +46,7 @@
static PyObject *
fadvise_dontneed(PyObject *self, PyObject *args)
{
+#if POSIX_FADV_DONTNEED
int fd;
/* Can't use off_t for offset and len, since PyArg_ParseTuple
doesn't know it. */
@@ -57,6 +58,9 @@ fadvise_dontneed(PyObject *self, PyObject *args)
return NULL;
ret = posix_fadvise(fd, offset, len, POSIX_FADV_DONTNEED);
return Py_BuildValue("i", ret);
+#else
+ return Py_BuildValue("i", 0);
+#endif
}