From: Aurelien Jarno Date: Thu, 28 Nov 2013 18:36:16 +0000 (-0600) Subject: Use the correct types when calling FS_IOC_GETFLAGS/FS_IOC_SETFLAGS. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=1abcd59349d1409a88b80abf56decd894849e57d;p=packages%2Fb%2Fbup.git Use the correct types when calling FS_IOC_GETFLAGS/FS_IOC_SETFLAGS. Despite the definitions in 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 [rlb@defaultvalue.org: adjust commit message; use "I" conversion to/from Python instead of "k".] Signed-off-by: Rob Browning --- diff --git a/lib/bup/_helpers.c b/lib/bup/_helpers.c index ca1053d..acf862c 100644 --- a/lib/bup/_helpers.c +++ b/lib/bup/_helpers.c @@ -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);