diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2024-03-13 06:31:28 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2024-03-13 06:55:44 -0700 |
commit | 2e384d4f44f15e560b2a068e0ed866438aaa7cd7 (patch) | |
tree | 57e59d6af7e7a76acfd3879885e399b509b78951 /bfd/bfdio.c | |
parent | 32235d90951b4b7c2976c61a28c30d82cb7a7588 (diff) | |
download | gdb-2e384d4f44f15e560b2a068e0ed866438aaa7cd7.zip gdb-2e384d4f44f15e560b2a068e0ed866438aaa7cd7.tar.gz gdb-2e384d4f44f15e560b2a068e0ed866438aaa7cd7.tar.bz2 |
bfd: Use MAP_FAILED for mmap failure
Use MAP_FAILED, instead of ((void *) -1), for mmap failure and use
((void *) -1) only if MAP_FAILED is undefined.
* bfdio.c (bfd_mmap): Replace (void *) -1 with MAP_FAILED for
mmap failure.
* bfdwin.c: Don't include <sys/mman.h>.
(MAP_FILE): Removed.
(bfd_get_file_window): Replace (void *) -1 with MAP_FAILED for
mmap failure.
* cache.c: Don't include <sys/mman.h>.
(cache_bmmap): Replace (void *) -1 with MAP_FAILED for mmap
failure.
* opncls.c (opncls_bmmap): Likewise.
* sysdep.h: Include <sys/mman.h> if HAVE_MMAP is define.
(MAP_FILE): New. Defined as 0 if undefined.
(MAP_FAILED): New. Defined as ((void *) -1) if undefined.
Diffstat (limited to 'bfd/bfdio.c')
-rw-r--r-- | bfd/bfdio.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/bfd/bfdio.c b/bfd/bfdio.c index ab3e28e..1572de0 100644 --- a/bfd/bfdio.c +++ b/bfd/bfdio.c @@ -666,7 +666,7 @@ bfd_mmap (bfd *abfd, void *addr, bfd_size_type len, if (abfd->iovec == NULL) { bfd_set_error (bfd_error_invalid_operation); - return (void *) -1; + return MAP_FAILED; } return abfd->iovec->bmmap (abfd, addr, len, prot, flags, offset, |