From 38e625da7f47e457d150efedc598437e2e867ef7 Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Thu, 20 Dec 2018 13:01:29 -0500 Subject: tests: shm: fix pwrite wrapper with -D_FILE_OFFSET_BITS=64 Due to the hacks used for large file support, wrapping pwrite is error prone and can end up calling the wrong function. Currently, "pwrite" is called instead of "pwrite64" on 32-bit ARM, causing the test to fail. This commit attempts to determine the correct symbol to call from the wrapper. --- tests/shm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/shm.c b/tests/shm.c index a0cf67e..26c5160 100644 --- a/tests/shm.c +++ b/tests/shm.c @@ -87,6 +87,12 @@ test_flag_nonexistent (void) dconf_shm_flag ("does-not-exist"); } +#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64 +#define PWRITE_SYM "pwrite64" +#else +#define PWRITE_SYM "pwrite" +#endif + static gboolean should_fail_pwrite; /* interpose */ ssize_t @@ -95,7 +101,7 @@ pwrite (int fd, const void *buf, size_t count, off_t offset) static ssize_t (* real_pwrite) (int, const void *, size_t, off_t); if (!real_pwrite) - real_pwrite = dlsym (RTLD_NEXT, "pwrite"); + real_pwrite = dlsym (RTLD_NEXT, PWRITE_SYM); if (should_fail_pwrite) { -- cgit v1.2.1