]> arthur.barton.de Git - bup.git/blobdiff - lib/bup/_helpers.c
bup_stat bup_lstat: always treat path as binary
[bup.git] / lib / bup / _helpers.c
index 87e8b82755d581762db9d9943fc822ed4cf5fb77..592c1217d077ad3c9e5ae68b6ea517927c485a84 100644 (file)
@@ -29,6 +29,9 @@
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
 
 #ifdef HAVE_LINUX_FS_H
 #include <linux/fs.h>
@@ -71,10 +74,10 @@ typedef struct {
 #if PY_MAJOR_VERSION < 3
 static state_t state;
 #  define get_state(x) (&state)
-#  define buf_argf "s"
+#  define cstr_argf "s"
 #else
 #  define get_state(x) ((state_t *) PyModule_GetState(x))
-#  define buf_argf "y"
+#  define cstr_argf "y"
 #endif // PY_MAJOR_VERSION >= 3
 
 
@@ -1405,7 +1408,7 @@ static PyObject *bup_stat(PyObject *self, PyObject *args)
     int rc;
     char *filename;
 
-    if (!PyArg_ParseTuple(args, "s", &filename))
+    if (!PyArg_ParseTuple(args, cstr_argf, &filename))
         return NULL;
 
     struct stat st;
@@ -1421,7 +1424,7 @@ static PyObject *bup_lstat(PyObject *self, PyObject *args)
     int rc;
     char *filename;
 
-    if (!PyArg_ParseTuple(args, "s", &filename))
+    if (!PyArg_ParseTuple(args, cstr_argf, &filename))
         return NULL;
 
     struct stat st;
@@ -1478,7 +1481,7 @@ static PyObject *bup_mincore(PyObject *self, PyObject *args)
     Py_buffer src, dest;
     PyObject *py_src_n, *py_src_off, *py_dest_off;
 
-    if (!PyArg_ParseTuple(args, buf_argf "*OOw*O",
+    if (!PyArg_ParseTuple(args, cstr_argf "*OOw*O",
                           &src, &py_src_n, &py_src_off,
                           &dest, &py_dest_off))
        return NULL;