]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* bfd/opncls.c (bfd_fopen): Mark returned BFD as cacheable if FD == -1.
authorMark Mitchell <mark@codesourcery.com>
Thu, 9 Jun 2005 07:39:08 +0000 (07:39 +0000)
committerMark Mitchell <mark@codesourcery.com>
Thu, 9 Jun 2005 07:39:08 +0000 (07:39 +0000)
ChangeLog.csl
bfd/opncls.c

index 0166a320acee9e5c5f81357f51522cffc73d4f62..e1315c10e316eece6be5a1794e860582e62d8dcd 100644 (file)
@@ -1,3 +1,7 @@
+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:
index 4a87062b49ccbd448c1d8cec70e0b7d91b9dfbfc..8249398a3c6d8106e2f1d524ee2a896b662b1a2f 100644 (file)
@@ -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;
 }