summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBen Wolsieffer <benwolsieffer@gmail.com>2018-12-20 13:01:29 -0500
committerDaniel Playfair Cal <daniel.playfair.cal@gmail.com>2019-02-12 19:32:21 +1100
commit38e625da7f47e457d150efedc598437e2e867ef7 (patch)
treeddc25b39a156b8ffd178c8753d40e775aa9afbf9 /tests
parentf0bb97ded21f8d2fb50065e7cfefade66a70333e (diff)
downloaddconf-38e625da7f47e457d150efedc598437e2e867ef7.tar.gz
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/shm.c8
1 files changed, 7 insertions, 1 deletions
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)
{