From: Mark Mitchell Date: Thu, 9 Jun 2005 07:30:19 +0000 (+0000) Subject: * opncls.c (bfd_fopen): Mark returned BFD as cacheable if FD == -1. X-Git-Tag: gdb-csl-arm-20051020-branchpoint~1056 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a366f4ff7b68695744106ce633100166f872d232;p=external%2Fbinutils.git * opncls.c (bfd_fopen): Mark returned BFD as cacheable if FD == -1. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 0b14267..1c90c89 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,7 @@ +2005-06-08 Mark Mitchell + + * opncls.c (bfd_fopen): Mark returned BFD as cacheable if FD == -1. + 2005-06-09 Alan Modra * elflink.c (elf_mark_used_section): Delete. 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 <>, so @var{target} is interpreted as by that function. + The new BFD is marked as cacheable iff @var{fd} is -1. + If <> is returned then an error has occured. Possible errors are <>, <> or <> 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; }