diff options
author | Mark Mitchell <mark@codesourcery.com> | 2005-06-09 07:30:19 +0000 |
---|---|---|
committer | Mark Mitchell <mark@codesourcery.com> | 2005-06-09 07:30:19 +0000 |
commit | a366f4ff7b68695744106ce633100166f872d232 (patch) | |
tree | 355b9426f1f05d1e7ca5f838065c3b4f716d821a /bfd/opncls.c | |
parent | dea2f0a859a292147d2543bcd7a4e138aa4ac72e (diff) | |
download | gdb-a366f4ff7b68695744106ce633100166f872d232.zip gdb-a366f4ff7b68695744106ce633100166f872d232.tar.gz gdb-a366f4ff7b68695744106ce633100166f872d232.tar.bz2 |
* opncls.c (bfd_fopen): Mark returned BFD as cacheable if FD == -1.
Diffstat (limited to 'bfd/opncls.c')
-rw-r--r-- | bfd/opncls.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/bfd/opncls.c b/bfd/opncls.c index df2cf6d..56b5925 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; } |