PR27382, build failure if fileno() is a macro

Message ID 20210209032356.GV5348@bubble.grove.modra.org
State New
Headers show
Series
  • PR27382, build failure if fileno() is a macro
Related show

Commit Message

H.J. Lu via Binutils Feb. 9, 2021, 3:23 a.m.
We lost the fix for this problem in the smart_rename reversion.
Committed to the 2.36 branch.

	PR 27382
	* objcopy.c (copy_file): Use bfd_stat.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 00d751522c4..eab3b6db585 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -3769,7 +3769,7 @@  copy_file (const char *input_filename, const char *output_filename, int ofd,
   /* To allow us to do "strip *" without dying on the first
      non-object file, failures are nonfatal.  */
   ibfd = bfd_openr (input_filename, input_target);
-  if (ibfd == NULL || fstat (fileno (ibfd->iostream), in_stat) != 0)
+  if (ibfd == NULL || bfd_stat (ibfd, in_stat) != 0)
     {
       bfd_nonfatal_message (input_filename, NULL, NULL, NULL);
       status = 1;