diff options
author | Steve Chamberlain <sac@cygnus> | 1992-05-26 14:51:23 +0000 |
---|---|---|
committer | Steve Chamberlain <sac@cygnus> | 1992-05-26 14:51:23 +0000 |
commit | 8b046402f5a322a59d3e29a41f4fdce2ba0f1499 (patch) | |
tree | f6fe724d3ae2c67b53b0dfd7edd1530f3d9b8aae /bfd | |
parent | d5ceae783f92f57693a5be5f1192b6794cc4b28c (diff) | |
download | gdb-8b046402f5a322a59d3e29a41f4fdce2ba0f1499.zip gdb-8b046402f5a322a59d3e29a41f4fdce2ba0f1499.tar.gz gdb-8b046402f5a322a59d3e29a41f4fdce2ba0f1499.tar.bz2 |
This is a test to see if the file is still locked.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/cache.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/bfd/cache.c b/bfd/cache.c index d0d3f23..1d4ee56 100644 --- a/bfd/cache.c +++ b/bfd/cache.c @@ -1,3 +1,4 @@ + /* BFD library -- caching of file descriptors. Copyright (C) 1990-1991 Free Software Foundation, Inc. Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.com). @@ -215,28 +216,31 @@ DEFUN(bfd_open_file, (abfd), bfd *abfd) { abfd->cacheable = true; /* Allow it to be closed later. */ + if(open_files >= BFD_CACHE_MAX_OPEN) { close_one(); } + switch (abfd->direction) { case read_direction: case no_direction: - abfd->iostream = (char *) fopen(abfd->filename, "rb"); + abfd->iostream = (char *) fopen(abfd->filename, FOPEN_RB); break; case both_direction: case write_direction: if (abfd->opened_once == true) { - abfd->iostream = (char *) fopen(abfd->filename, "r+b"); + abfd->iostream = (char *) fopen(abfd->filename, FOPEN_RUB); if (!abfd->iostream) { - abfd->iostream = (char *) fopen(abfd->filename, "w+b"); + abfd->iostream = (char *) fopen(abfd->filename, FOPEN_WUB); } } else { /*open for creat */ - abfd->iostream = (char *) fopen(abfd->filename, "wb"); + abfd->iostream = (char *) fopen(abfd->filename, FOPEN_WB); abfd->opened_once = true; } break; } + if (abfd->iostream) { open_files++; bfd_cache_init (abfd); |