]> arthur.barton.de Git - bup.git/commitdiff
Use the correct types when calling FS_IOC_GETFLAGS/FS_IOC_SETFLAGS.
authorAurelien Jarno <aurelien@aurel32.net>
Thu, 28 Nov 2013 18:36:16 +0000 (12:36 -0600)
committerRob Browning <rlb@defaultvalue.org>
Fri, 29 Nov 2013 04:30:23 +0000 (22:30 -0600)
Despite the definitions in <linux/fs.h> these ioctls take int
arguments, not longs. This is important for 64-bit big endian
machines.

See http://marc.info/?l=linux-fsdevel&m=138552482917220&w=2

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
[rlb@defaultvalue.org: adjust commit message; use "I" conversion
 to/from Python instead of "k".]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/_helpers.c

index ca1053db2245530db3bee5b57a535b6b294a4c1b..acf862c36d8e09771441871a3a584478782c24cb 100644 (file)
@@ -693,7 +693,7 @@ static PyObject *fadvise_done(PyObject *self, PyObject *args)
 static PyObject *bup_get_linux_file_attr(PyObject *self, PyObject *args)
 {
     int rc;
-    unsigned long attr;
+    unsigned int attr;
     char *path;
     int fd;
 
@@ -713,7 +713,7 @@ static PyObject *bup_get_linux_file_attr(PyObject *self, PyObject *args)
     }
 
     close(fd);
-    return Py_BuildValue("k", attr);
+    return Py_BuildValue("I", attr);
 }
 #endif /* def BUP_HAVE_FILE_ATTRS */
 
@@ -722,11 +722,11 @@ static PyObject *bup_get_linux_file_attr(PyObject *self, PyObject *args)
 static PyObject *bup_set_linux_file_attr(PyObject *self, PyObject *args)
 {
     int rc;
-    unsigned long orig_attr, attr;
+    unsigned int orig_attr, attr;
     char *path;
     int fd;
 
-    if (!PyArg_ParseTuple(args, "sk", &path, &attr))
+    if (!PyArg_ParseTuple(args, "sI", &path, &attr))
         return NULL;
 
     fd = open(path, O_RDONLY | O_NONBLOCK | O_LARGEFILE | O_NOFOLLOW);