GNU Binutils with patches for OS216
Révision | 6bd2c2c435217d4de9b7b64ce419fb6a2caa9dd5 (tree) |
---|---|
l'heure | 2005-06-09 16:39:08 |
Auteur | Mark Mitchell <mark@code...> |
Commiter | Mark Mitchell |
* bfd/opncls.c (bfd_fopen): Mark returned BFD as cacheable if FD == -1.
@@ -1,5 +1,9 @@ | ||
1 | 1 | 2005-06-08 Mark Mitchell <mark@codesourcery.com> |
2 | 2 | |
3 | + * bfd/opncls.c (bfd_fopen): Mark returned BFD as cacheable if FD == -1. | |
4 | + | |
5 | +2005-06-08 Mark Mitchell <mark@codesourcery.com> | |
6 | + | |
3 | 7 | Revert: |
4 | 8 | 2005-03-28 Mark Mitchell <mark@codesourcery.com> |
5 | 9 | * readline/display.c (insert_some_chars): Likewise. |
@@ -144,6 +144,8 @@ DESCRIPTION | ||
144 | 144 | Calls <<bfd_find_target>>, so @var{target} is interpreted as by |
145 | 145 | that function. |
146 | 146 | |
147 | + The new BFD is marked as cacheable iff @var{fd} is -1. | |
148 | + | |
147 | 149 | If <<NULL>> is returned then an error has occured. Possible errors |
148 | 150 | are <<bfd_error_no_memory>>, <<bfd_error_invalid_target>> or |
149 | 151 | <<system_call>> error. |
@@ -198,6 +200,12 @@ bfd_fopen (const char *filename, const char *target, const char *mode, int fd) | ||
198 | 200 | return NULL; |
199 | 201 | } |
200 | 202 | nbfd->opened_once = TRUE; |
203 | + /* If we opened the file by name, mark it cacheable; we can close it | |
204 | + and reopen it later. However, if a file descriptor was provided, | |
205 | + then it may have been opened with special flags that make it | |
206 | + unsafe to close and reopen the file. */ | |
207 | + if (fd == -1) | |
208 | + bfd_set_cacheable (nbfd, TRUE); | |
201 | 209 | |
202 | 210 | return nbfd; |
203 | 211 | } |