+2014-11-10 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/17552
+ * (copy_archive): Clean up temporary files even if an error
+ occurs.
+
2014-11-07 H.J. Lu <hongjiu.lu@intel.com>
* readelf.c (process_dynamic_section): Cast time value to unsigned
/* PR binutils/17533: Do not allow directory traversal
outside of the current directory tree by archive members. */
if (! is_valid_archive_path (bfd_get_filename (this_element)))
- fatal (_("illegal pathname found in archive member: %s"),
- bfd_get_filename (this_element));
+ {
+ non_fatal (_("illegal pathname found in archive member: %s"),
+ bfd_get_filename (this_element));
+ status = 1;
+ goto cleanup_and_exit;
+ }
/* Create an output file for this member. */
output_name = concat (dir, "/",
{
output_name = make_tempdir (output_name);
if (output_name == NULL)
- fatal (_("cannot create tempdir for archive copying (error: %s)"),
- strerror (errno));
+ {
+ non_fatal (_("cannot create tempdir for archive copying (error: %s)"),
+ strerror (errno));
+ status = 1;
+ goto cleanup_and_exit;
+ }
l = (struct name_list *) xmalloc (sizeof (struct name_list));
l->name = output_name;
{
bfd_nonfatal_message (output_name, NULL, NULL, NULL);
status = 1;
- return;
+ goto cleanup_and_exit;
}
if (ok_object)
{
status = 1;
bfd_nonfatal_message (filename, NULL, NULL, NULL);
- return;
}
filename = bfd_get_filename (ibfd);
{
status = 1;
bfd_nonfatal_message (filename, NULL, NULL, NULL);
- return;
}
+ cleanup_and_exit:
/* Delete all the files that we opened. */
for (l = list; l != NULL; l = l->next)
{