aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1995-07-04 20:47:10 +0000
committerIan Lance Taylor <ian@airs.com>1995-07-04 20:47:10 +0000
commit4c8d7e6be162d79b66f75d5049a870b9b306254b (patch)
tree5980465bd1156e06daeadda5557c4b8c3d414bed /binutils
parentcbd0453da48ab23efdc955e086578064b899c0c4 (diff)
downloadgdb-4c8d7e6be162d79b66f75d5049a870b9b306254b.zip
gdb-4c8d7e6be162d79b66f75d5049a870b9b306254b.tar.gz
gdb-4c8d7e6be162d79b66f75d5049a870b9b306254b.tar.bz2
* objcopy.c (copy_archive): Record all output BFD's, and close
them before unlinking them and removing the temporary directory, to avoid NFS problems. PR 6795.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog4
-rw-r--r--binutils/objcopy.c16
2 files changed, 15 insertions, 5 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 4f16e4d..14b185c 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,9 @@
Tue Jul 4 14:48:42 1995 Ian Lance Taylor <ian@cygnus.com>
+ * objcopy.c (copy_archive): Record all output BFD's, and close
+ them before unlinking them and removing the temporary directory,
+ to avoid NFS problems.
+
* ar.c (replace_members): In verbose messages, use 'r' when
replacing a member, and 'a' when adding one.
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index ba00c01..0ef9ceb 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -820,6 +820,7 @@ copy_archive (ibfd, obfd, output_target)
{
struct name_list *next;
char *name;
+ bfd *obfd;
} *list, *l;
bfd **ptr = &obfd->archive_head;
bfd *this_element;
@@ -867,6 +868,8 @@ copy_archive (ibfd, obfd, output_target)
/* Open the newly output file and attach to our list. */
output_bfd = bfd_openr (output_name, output_target);
+ l->obfd = output_bfd;
+
*ptr = output_bfd;
ptr = &output_bfd->next;
@@ -883,15 +886,18 @@ copy_archive (ibfd, obfd, output_target)
nonfatal (bfd_get_filename (obfd));
}
- /* Delete all the files that we opened. */
- for (l = list; l != NULL; l = l->next)
- unlink (l->name);
- rmdir (dir);
-
if (!bfd_close (ibfd))
{
nonfatal (bfd_get_filename (ibfd));
}
+
+ /* Delete all the files that we opened. */
+ for (l = list; l != NULL; l = l->next)
+ {
+ bfd_close (l->obfd);
+ unlink (l->name);
+ }
+ rmdir (dir);
}
/* The top-level control. */