aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2005-06-09 07:39:08 +0000
committerMark Mitchell <mark@codesourcery.com>2005-06-09 07:39:08 +0000
commit6bd2c2c435217d4de9b7b64ce419fb6a2caa9dd5 (patch)
tree15b2af3f1c23d79ac079ad03890d2cf1f83d2084
parentdcc7c2fc03c0f96eb65fcad6f0d3819621feb8fd (diff)
downloadgdb-6bd2c2c435217d4de9b7b64ce419fb6a2caa9dd5.zip
gdb-6bd2c2c435217d4de9b7b64ce419fb6a2caa9dd5.tar.gz
gdb-6bd2c2c435217d4de9b7b64ce419fb6a2caa9dd5.tar.bz2
* bfd/opncls.c (bfd_fopen): Mark returned BFD as cacheable if FD == -1.
-rw-r--r--ChangeLog.csl4
-rw-r--r--bfd/opncls.c8
2 files changed, 12 insertions, 0 deletions
diff --git a/ChangeLog.csl b/ChangeLog.csl
index 0166a32..e1315c1 100644
--- a/ChangeLog.csl
+++ b/ChangeLog.csl
@@ -1,5 +1,9 @@
2005-06-08 Mark Mitchell <mark@codesourcery.com>
+ * bfd/opncls.c (bfd_fopen): Mark returned BFD as cacheable if FD == -1.
+
+2005-06-08 Mark Mitchell <mark@codesourcery.com>
+
Revert:
2005-03-28 Mark Mitchell <mark@codesourcery.com>
* readline/display.c (insert_some_chars): Likewise.
diff --git a/bfd/opncls.c b/bfd/opncls.c
index 4a87062..8249398 100644
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -144,6 +144,8 @@ DESCRIPTION
Calls <<bfd_find_target>>, so @var{target} is interpreted as by
that function.
+ The new BFD is marked as cacheable iff @var{fd} is -1.
+
If <<NULL>> is returned then an error has occured. Possible errors
are <<bfd_error_no_memory>>, <<bfd_error_invalid_target>> or
<<system_call>> error.
@@ -198,6 +200,12 @@ bfd_fopen (const char *filename, const char *target, const char *mode, int fd)
return NULL;
}
nbfd->opened_once = TRUE;
+ /* If we opened the file by name, mark it cacheable; we can close it
+ and reopen it later. However, if a file descriptor was provided,
+ then it may have been opened with special flags that make it
+ unsafe to close and reopen the file. */
+ if (fd == -1)
+ bfd_set_cacheable (nbfd, TRUE);
return nbfd;
}