#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
-#ifdef HAVE_LINUX_EXT2_FS_H
-#include <linux/ext2_fs.h>
-#endif
-#if defined(FS_IOC_GETFLAGS) && defined(FS_IOC_SETFLAGS) \
- && defined(HAVE_LINUX_EXT2_FS_H)
+#if defined(FS_IOC_GETFLAGS) && defined(FS_IOC_SETFLAGS)
#define BUP_HAVE_FILE_ATTRS 1
#endif
}
-static PyObject *open_noatime(PyObject *self, PyObject *args)
+static int _open_noatime(const char *filename, int attrs)
{
- char *filename = NULL;
- int attrs, attrs_noatime, fd;
- if (!PyArg_ParseTuple(args, "s", &filename))
- return NULL;
- attrs = O_RDONLY;
+ int attrs_noatime, fd;
+ attrs |= O_RDONLY;
#ifdef O_NOFOLLOW
attrs |= O_NOFOLLOW;
#endif
// just harmlessly ignore it, so this branch won't trigger)
fd = open(filename, attrs);
}
+ return fd;
+}
+
+
+static PyObject *open_noatime(PyObject *self, PyObject *args)
+{
+ char *filename = NULL;
+ int fd;
+ if (!PyArg_ParseTuple(args, "s", &filename))
+ return NULL;
+ fd = _open_noatime(filename, 0);
if (fd < 0)
return PyErr_SetFromErrnoWithFilename(PyExc_OSError, filename);
return Py_BuildValue("i", fd);
if (!PyArg_ParseTuple(args, "s", &path))
return NULL;
- fd = open(path, O_RDONLY | O_NONBLOCK | O_LARGEFILE | O_NOFOLLOW);
+ fd = _open_noatime(path, O_NONBLOCK);
if (fd == -1)
return PyErr_SetFromErrnoWithFilename(PyExc_OSError, path);