binutils: Use file descriptors from make_tempname
authorSiddhesh Poyarekar <siddhesh@gotplt.org>
Mon, 7 Dec 2020 15:18:23 +0000 (20:48 +0530)
committerSiddhesh Poyarekar <siddhesh@gotplt.org>
Mon, 7 Dec 2020 15:18:23 +0000 (20:48 +0530)
commit365f5fb6d0f0da83817431a275e99e6f6babbe04
tree2fc2d6dfad654e6dba514065239d22be824b4d4a
parenta4915e8d6ceac18826d2c832cb1303690dc9f256
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.
bfd/ChangeLog
bfd/bfd-in2.h
bfd/opncls.c
binutils/ChangeLog
binutils/ar.c
binutils/bucomm.c
binutils/bucomm.h
binutils/objcopy.c
This page took 0.024541 seconds and 4 git commands to generate.