PR27382, build failure if fileno() is a macro

Alan Modra amodra@gmail.com
Tue Feb 9 03:23:56 GMT 2021


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.

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;

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list