aboutsummaryrefslogtreecommitdiff
path: root/bfd/opncls.c
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1991-05-11 00:38:47 +0000
committerJohn Gilmore <gnu@cygnus>1991-05-11 00:38:47 +0000
commit2b1d8a50a0c7769fbbee5dc848241562227aafd8 (patch)
tree6d05b87753beb7129ff34987d75945d181e37f01 /bfd/opncls.c
parent78aa64b14c8be80926613705c9cb378117061a8d (diff)
downloadgdb-2b1d8a50a0c7769fbbee5dc848241562227aafd8.zip
gdb-2b1d8a50a0c7769fbbee5dc848241562227aafd8.tar.gz
gdb-2b1d8a50a0c7769fbbee5dc848241562227aafd8.tar.bz2
Cleanups of interface, including close_and_cleanup and write_contents
transfer vector changes. See ChangeLog.
Diffstat (limited to 'bfd/opncls.c')
-rw-r--r--bfd/opncls.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/bfd/opncls.c b/bfd/opncls.c
index b280a13..65687e6 100644
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -257,11 +257,16 @@ boolean
bfd_close (abfd)
bfd *abfd;
{
+ if (!bfd_read_p(abfd))
+ if (BFD_SEND_FMT (abfd, _bfd_write_contents, (abfd)) != true)
+ return false;
+
if (BFD_SEND (abfd, _close_and_cleanup, (abfd)) != true) return false;
bfd_cache_close(abfd);
-/* If the file was open for writing and is now executable
- make it so */
+
+ /* If the file was open for writing and is now executable,
+ make it so */
if (abfd->direction == write_direction
&& abfd->flags & EXEC_P) {
struct stat buf;
@@ -269,6 +274,7 @@ bfd_close (abfd)
chmod(abfd->filename,buf.st_mode | S_IXUSR | S_IXGRP | S_IXOTH);
}
(void) obstack_free (&abfd->memory, (PTR)0);
+ /* FIXME, shouldn't we de-allocate the bfd as well? */
return true;
}