diff options
author | John Gilmore <gnu@cygnus> | 1991-05-29 00:20:02 +0000 |
---|---|---|
committer | John Gilmore <gnu@cygnus> | 1991-05-29 00:20:02 +0000 |
commit | c0e5039e64287c34a99d59493d7ea8d2faa9bed4 (patch) | |
tree | 8f34ff4b2530aaef3922f26be3f9f711d6daa944 /bfd/opncls.c | |
parent | dcc355360e4b039cbe4fb56339d6f490d26b917e (diff) | |
download | gdb-c0e5039e64287c34a99d59493d7ea8d2faa9bed4.zip gdb-c0e5039e64287c34a99d59493d7ea8d2faa9bed4.tar.gz gdb-c0e5039e64287c34a99d59493d7ea8d2faa9bed4.tar.bz2 |
Merge in changes from gdb-3.95 release into mainstream of BFD development.
Support defaulted (search all) targets and specific (only check one)
targets.
Diffstat (limited to 'bfd/opncls.c')
-rw-r--r-- | bfd/opncls.c | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/bfd/opncls.c b/bfd/opncls.c index fdd7f4b..84c6651 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -107,21 +107,19 @@ DEFUN(bfd_openr, (filename, target), bfd *nbfd; bfd_target *target_vec; - target_vec = bfd_find_target (target); - if (target_vec == NULL) { - bfd_error = invalid_target; - return NULL; - } - - bfd_error = system_call_error; nbfd = new_bfd(); if (nbfd == NULL) { bfd_error = no_memory; return NULL; } + target_vec = bfd_find_target (target, nbfd); + if (target_vec == NULL) { + bfd_error = invalid_target; + return NULL; + } + nbfd->filename = filename; - nbfd->xvec = target_vec; nbfd->direction = read_direction; if (bfd_open_file (nbfd) == NULL) { @@ -155,12 +153,6 @@ DEFUN(bfd_fdopenr,(filename, target, fd), struct flock lock, *lockp = &lock; #endif - target_vec = bfd_find_target (target); - if (target_vec == NULL) { - bfd_error = invalid_target; - return NULL; - } - bfd_error = system_call_error; fdflags = fcntl (fd, F_GETFL); @@ -177,6 +169,13 @@ DEFUN(bfd_fdopenr,(filename, target, fd), bfd_error = no_memory; return NULL; } + + target_vec = bfd_find_target (target, nbfd); + if (target_vec == NULL) { + bfd_error = invalid_target; + return NULL; + } + #ifdef BFD_LOCKS nbfd->lock = (struct flock *) (nbfd + 1); #endif @@ -190,7 +189,6 @@ DEFUN(bfd_fdopenr,(filename, target, fd), /* OK, put everything where it belongs */ nbfd->filename = filename; - nbfd->xvec = target_vec; /* As a special case we allow a FD open for read/write to be written through, although doing so requires that we end @@ -206,7 +204,7 @@ DEFUN(bfd_fdopenr,(filename, target, fd), memcpy (nbfd->lock, lockp, sizeof (struct flock)) #endif - bfd_cache_init (nbfd); + bfd_cache_init (nbfd); return nbfd; } @@ -224,9 +222,6 @@ DEFUN(bfd_openw,(filename, target), bfd *nbfd; bfd_target *target_vec; - target_vec = bfd_find_target (target); - if (target_vec == NULL) return NULL; - bfd_error = system_call_error; /* nbfd has to point to head of malloc'ed block so that bfd_close may @@ -238,8 +233,10 @@ DEFUN(bfd_openw,(filename, target), return NULL; } + target_vec = bfd_find_target (target, nbfd); + if (target_vec == NULL) return NULL; + nbfd->filename = filename; - nbfd->xvec = target_vec; nbfd->direction = write_direction; if (bfd_open_file (nbfd) == NULL) { @@ -249,10 +246,8 @@ DEFUN(bfd_openw,(filename, target), } return nbfd; } - - -/** Close up shop, get your deposit back. */ +/* Close up shop, get your deposit back. */ boolean bfd_close (abfd) bfd *abfd; |