* objcopy.c (copy_archive): Record all output BFD's, and close
authorIan Lance Taylor <ian@airs.com>
Tue, 4 Jul 1995 20:47:10 +0000 (20:47 +0000)
committerIan Lance Taylor <ian@airs.com>
Tue, 4 Jul 1995 20:47:10 +0000 (20:47 +0000)
them before unlinking them and removing the temporary directory,
to avoid NFS problems.
PR 6795.

binutils/ChangeLog
binutils/objcopy.c

index 4f16e4dcd5b2ae3c8163d77bf9c1699a17124174..14b185cef55e609793d713f969eed1375083e22e 100644 (file)
@@ -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.
 
index ba00c01921064eb76fc8e0ff6dc5b735b84ba65c..0ef9cebcdee2f43aa9f8bb23427b87361fd18147 100644 (file)
@@ -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.  */
This page took 0.028728 seconds and 4 git commands to generate.