[dconf: 1/3] tests: shm: fix pwrite wrapper with -D_FILE_OFFSET_BITS=64
- From: Daniel Playfair Cal <danielplayfaircal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf: 1/3] tests: shm: fix pwrite wrapper with -D_FILE_OFFSET_BITS=64
- Date: Tue, 12 Feb 2019 22:17:33 +0000 (UTC)
commit 38e625da7f47e457d150efedc598437e2e867ef7
Author: Ben Wolsieffer <benwolsieffer gmail com>
Date: Thu Dec 20 13:01:29 2018 -0500
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)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]