From 365f5fb6d0f0da83817431a275e99e6f6babbe04 Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Mon, 7 Dec 2020 20:48:23 +0530 Subject: binutils: Use file descriptors from make_tempname The purpose of creating a temporary file securely using mkstemp is defeated if it is closed in make_tempname and reopened later for use; it is as good as using mktemp. Get the file descriptor instead and then use it to create the BFD object. bfd/ * opncls.c (bfd_fdopenw): New function. * bfd-in2.h: Regenerate. binutils/ * bucomm.c (make_tempname): Add argument to return file descriptor. * bucomm.h (make_tempname): Likewise. * ar.c: Include libbfd.h. (write_archive): Adjust for change in make_tempname. Call bfd_fdopenw instead of bfd_openw. * objcopy.c: Include libbfd.h. (copy_file): New argument OFD. Use bfd_fdopenw instead of bfd_openw. (strip_main): Adjust for change in make_tempname and copy_file. (copy_main): Likewise. --- binutils/bucomm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'binutils/bucomm.h') diff --git a/binutils/bucomm.h b/binutils/bucomm.h index d831834..afb8e09 100644 --- a/binutils/bucomm.h +++ b/binutils/bucomm.h @@ -51,7 +51,7 @@ int display_info (void); void print_arelt_descr (FILE *, bfd *, bfd_boolean, bfd_boolean); -char *make_tempname (const char *); +char *make_tempname (const char *, int *); char *make_tempdir (const char *); bfd_vma parse_vma (const char *, const char *); -- cgit v1.1