mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-21 02:24:17 +08:00
This is a test to see if the file is still locked.
This commit is contained in:
12
bfd/cache.c
12
bfd/cache.c
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
/* BFD library -- caching of file descriptors.
|
/* BFD library -- caching of file descriptors.
|
||||||
Copyright (C) 1990-1991 Free Software Foundation, Inc.
|
Copyright (C) 1990-1991 Free Software Foundation, Inc.
|
||||||
Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
|
Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
|
||||||
@ -215,28 +216,31 @@ DEFUN(bfd_open_file, (abfd),
|
|||||||
bfd *abfd)
|
bfd *abfd)
|
||||||
{
|
{
|
||||||
abfd->cacheable = true; /* Allow it to be closed later. */
|
abfd->cacheable = true; /* Allow it to be closed later. */
|
||||||
|
|
||||||
if(open_files >= BFD_CACHE_MAX_OPEN) {
|
if(open_files >= BFD_CACHE_MAX_OPEN) {
|
||||||
close_one();
|
close_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (abfd->direction) {
|
switch (abfd->direction) {
|
||||||
case read_direction:
|
case read_direction:
|
||||||
case no_direction:
|
case no_direction:
|
||||||
abfd->iostream = (char *) fopen(abfd->filename, "rb");
|
abfd->iostream = (char *) fopen(abfd->filename, FOPEN_RB);
|
||||||
break;
|
break;
|
||||||
case both_direction:
|
case both_direction:
|
||||||
case write_direction:
|
case write_direction:
|
||||||
if (abfd->opened_once == true) {
|
if (abfd->opened_once == true) {
|
||||||
abfd->iostream = (char *) fopen(abfd->filename, "r+b");
|
abfd->iostream = (char *) fopen(abfd->filename, FOPEN_RUB);
|
||||||
if (!abfd->iostream) {
|
if (!abfd->iostream) {
|
||||||
abfd->iostream = (char *) fopen(abfd->filename, "w+b");
|
abfd->iostream = (char *) fopen(abfd->filename, FOPEN_WUB);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/*open for creat */
|
/*open for creat */
|
||||||
abfd->iostream = (char *) fopen(abfd->filename, "wb");
|
abfd->iostream = (char *) fopen(abfd->filename, FOPEN_WB);
|
||||||
abfd->opened_once = true;
|
abfd->opened_once = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (abfd->iostream) {
|
if (abfd->iostream) {
|
||||||
open_files++;
|
open_files++;
|
||||||
bfd_cache_init (abfd);
|
bfd_cache_init (abfd);
|
||||||
|
Reference in New Issue
Block a user