aboutsummaryrefslogtreecommitdiff
path: root/bfd/libbfd.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1995-11-08 21:24:33 +0000
committerIan Lance Taylor <ian@airs.com>1995-11-08 21:24:33 +0000
commit0bb8ff191ec9e1c54f17a0a2e3faff7ae75cadd7 (patch)
tree63a163919865fde9239a563010c7b191c03c7bf0 /bfd/libbfd.c
parent7812bf9c25192463489dfb439eb92b2fcd34f305 (diff)
downloadbinutils-0bb8ff191ec9e1c54f17a0a2e3faff7ae75cadd7.zip
binutils-0bb8ff191ec9e1c54f17a0a2e3faff7ae75cadd7.tar.gz
binutils-0bb8ff191ec9e1c54f17a0a2e3faff7ae75cadd7.tar.bz2
* libbfd.c (bfd_get_file_window): Change writable parameter from
int to boolean; update all callers. Pass MAP_SHARED if not writable--it's required on Solaris. Cast fprintf argument to avoid warning. * bfd-in.h (bfd_get_file_window): Update declaration. * bfd-in2.h: Rebuild. * aoutx.h: Update calls to bfd_get_file_window.
Diffstat (limited to 'bfd/libbfd.c')
-rw-r--r--bfd/libbfd.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/bfd/libbfd.c b/bfd/libbfd.c
index 291b1fd..c2d8b9f 100644
--- a/bfd/libbfd.c
+++ b/bfd/libbfd.c
@@ -308,7 +308,7 @@ bfd_get_file_window (abfd, offset, size, windowp, writable)
file_ptr offset;
bfd_size_type size;
bfd_window *windowp;
- int writable;
+ boolean writable;
{
static size_t pagesize;
bfd_window_internal *i = windowp->i;
@@ -367,7 +367,9 @@ bfd_get_file_window (abfd, offset, size, windowp, writable)
}
i->data = mmap (i->data, real_size,
writable ? PROT_WRITE | PROT_READ : PROT_READ,
- writable ? MAP_FILE | MAP_PRIVATE : MAP_FILE,
+ (writable
+ ? MAP_FILE | MAP_PRIVATE
+ : MAP_FILE | MAP_SHARED),
fd, file_offset);
if (i->data == (PTR) -1)
{
@@ -393,7 +395,7 @@ bfd_get_file_window (abfd, offset, size, windowp, writable)
{
if (ok_to_map)
fprintf (stderr, "not mapping: data=%x mapped=%d\n",
- i->data, i->mapped);
+ i->data, (int) i->mapped);
else
fprintf (stderr, "not mapping: env var not set\n");
}
@@ -1039,7 +1041,7 @@ _bfd_generic_get_section_contents_in_window (abfd, section, w, offset, count)
return bfd_get_section_contents (abfd, section, w->data, offset, count);
}
if ((bfd_size_type) (offset+count) > section->_raw_size
- || (bfd_get_file_window (abfd, section->filepos + offset, count, w, 1)
+ || (bfd_get_file_window (abfd, section->filepos + offset, count, w, true)
== false))
return false;
return true;