diff options
author | Paul Eggert <eggert@trombone> | 2023-01-22 00:49:04 -0600 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2023-01-22 00:49:53 -0600 |
commit | b5e5591e934caaa561e3b6ab7bcb3f50db93f841 (patch) | |
tree | 204c20ca354c093bfdaab72fe7fa055cff5a1036 /lib/vma-iter.c | |
parent | 9041103ed4a5bd4406d05cf12e46330b3dabb33c (diff) | |
download | gnulib-b5e5591e934caaa561e3b6ab7bcb3f50db93f841.tar.gz |
sigsegv, vma-iter: port to Solaris 10
On this platform, <sys/types.h> does not define off_t if neither
_LP64 nor _FILE_OFFSET_BITS is defined, which can happen if we
#undef _FILE_OFFSET_BITS. This became a problem with the new way
of doing stdbool, since config.h now includes <stdbool.h>, and
Solaris 10 <stdbool.h> includes <sys/feature_tests.h> which
arranges for _FILE_OFFSET_BITS to always be defined (if only to 32),
which <sys/types.h> assumes.
* lib/stackvma.c, lib/vma-iter.c (_FILE_OFFSET_BITS) [__sun && !_LP64]:
Define to 32 instead of leaving undefined.
Diffstat (limited to 'lib/vma-iter.c')
-rw-r--r-- | lib/vma-iter.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/vma-iter.c b/lib/vma-iter.c index ccb221d273..2584d5ec34 100644 --- a/lib/vma-iter.c +++ b/lib/vma-iter.c @@ -20,6 +20,7 @@ /* On Solaris in 32-bit mode, when gnulib module 'largefile' is in use, prevent a compilation error "Cannot use procfs in the large file compilation environment" + while also preventing <sys/types.h> from not defining off_t. On Android, when targeting Android 4.4 or older with a GCC toolchain, prevent a compilation error "error: call to 'mmap' declared with attribute error: mmap is not @@ -28,7 +29,11 @@ switch to Clang." The files that we access in this compilation unit are less than 2 GB large. */ -#if defined __sun || defined __ANDROID__ +#if defined __sun && !defined _LP64 && _FILE_OFFSET_BITS == 64 +# undef _FILE_OFFSET_BITS +# define _FILE_OFFSET_BITS 32 +#endif +#ifdef __ANDROID__ # undef _FILE_OFFSET_BITS #endif |