[binutils-gdb/binutils-2_36-branch] PR27382, build failure if fileno() is a macro

Alan Modra amodra@sourceware.org
Tue Feb 9 03:19:16 GMT 2021


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7651a4871c225925ffdfda0a8c91a6ed370cd9a1

commit 7651a4871c225925ffdfda0a8c91a6ed370cd9a1
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Feb 9 13:32:36 2021 +1030

    PR27382, build failure if fileno() is a macro
    
            PR 27382
            * objcopy.c (copy_file): Use bfd_stat.

Diff:
---
 binutils/ChangeLog | 5 +++++
 binutils/objcopy.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 8b08bd0db79..b60e55d1632 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2021-02-09  Alan Modra  <amodra@gmail.com>
+
+	PR 27382
+	* objcopy.c (copy_file): Use bfd_stat.
+
 2021-02-06  Nick Clifton  <nickc@redhat.com>
 
 	This is the 2.36.1 release.
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;


More information about the Binutils-cvs mailing list