diff options
author | Zac Medico <zmedico@gentoo.org> | 2017-05-07 16:32:19 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2017-05-09 09:22:45 -0700 |
commit | 1a7aeb58c4e687e4d4012054b56373f27941a067 (patch) | |
tree | 0ab55a2cbbe610df564eecf2c4c11396d416f2f2 | |
parent | Eventloop: fix deadlock involving idle_add/call_soon (bug 617550) (diff) | |
download | portage-1a7aeb58c4e687e4d4012054b56373f27941a067.tar.gz portage-1a7aeb58c4e687e4d4012054b56373f27941a067.tar.bz2 portage-1a7aeb58c4e687e4d4012054b56373f27941a067.zip |
file_copy: replace loff_t with off_t for portability (bug 617778)
The loff_t type is a GNU extension, so use the portable off_t
type instead. Also, enable Large File Support macros in setup.py,
for 64-bit offsets.
Reported-by: Patrick Steinhardt <ps@pks.im>
X-Gentoo-bug: 617778
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=617778
Acked-by: Anthony G. Basile <blueness@gentoo.org>
Acked-by: Brian Dolbec <dolsen@gentoo.org>
-rwxr-xr-x | setup.py | 5 | ||||
-rw-r--r-- | src/portage_util_file_copy_reflink_linux.c | 6 |
2 files changed, 7 insertions, 4 deletions
@@ -676,7 +676,10 @@ setup( ['$sysconfdir/portage/repo.postsync.d', ['cnf/repo.postsync.d/example']], ], - ext_modules = [Extension(name=n, sources=m) for n, m in x_c_helpers.items()], + ext_modules = [Extension(name=n, sources=m, + extra_compile_args=['-D_FILE_OFFSET_BITS=64', + '-D_LARGEFILE_SOURCE', '-D_LARGEFILE64_SOURCE']) + for n, m in x_c_helpers.items()], cmdclass = { 'build': x_build, diff --git a/src/portage_util_file_copy_reflink_linux.c b/src/portage_util_file_copy_reflink_linux.c index b031d962d..2fb17a0f5 100644 --- a/src/portage_util_file_copy_reflink_linux.c +++ b/src/portage_util_file_copy_reflink_linux.c @@ -66,7 +66,7 @@ initreflink_linux(void) * (errno is set appropriately). */ static ssize_t -cfr_wrapper(int fd_out, int fd_in, loff_t *off_out, size_t len) +cfr_wrapper(int fd_out, int fd_in, off_t *off_out, size_t len) { #ifdef __NR_copy_file_range return syscall(__NR_copy_file_range, fd_in, NULL, fd_out, @@ -96,7 +96,7 @@ cfr_wrapper(int fd_out, int fd_in, loff_t *off_out, size_t len) * reaches EOF. */ static off_t -do_lseek_data(int fd_out, int fd_in, loff_t *off_out) { +do_lseek_data(int fd_out, int fd_in, off_t *off_out) { #ifdef SEEK_DATA /* Use lseek SEEK_DATA/SEEK_HOLE for sparse file support, * as suggested in the copy_file_range man page. @@ -189,7 +189,7 @@ _reflink_linux_file_copy(PyObject *self, PyObject *args) ssize_t buf_bytes, buf_offset, copyfunc_ret; struct stat stat_in, stat_out; char* buf; - ssize_t (*copyfunc)(int, int, loff_t *, size_t); + ssize_t (*copyfunc)(int, int, off_t *, size_t); if (!PyArg_ParseTuple(args, "ii", &fd_in, &fd_out)) return NULL; |