[binutils-gdb] Fix a problem in the assembler when checking for overlapping input and output files on non-POSIX com

Nick Clifton nickc@sourceware.org
Mon May 14 12:05:00 GMT 2018


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

commit c3533c4c7c5db84b27e4dc8994a3c3a893077c03
Author: Nick Clifton <nickc@redhat.com>
Date:   Mon May 14 13:05:02 2018 +0100

    Fix a problem in the assembler when checking for overlapping input and output files on non-POSIX compliant systems.
    
    	PR 23153
    	* as.c (main): When checking for an output file that is also an
    	input file, also check that the inode is not zero.

Diff:
---
 gas/ChangeLog | 6 ++++++
 gas/as.c      | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 200879c..8322ccf 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2018-05-14  Nick Clifton  <nickc@redhat.com>
+
+	PR 23153
+	* as.c (main): When checking for an output file that is also an
+	input file, also check that the inode is not zero.
+
 2018-05-12  Alan Modra  <amodra@gmail.com>
 
 	* config/tc-score.c (s3_do_macro_bcmp): Don't use fixed size
diff --git a/gas/as.c b/gas/as.c
index cdf8cfe..02c7d29 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -1256,7 +1256,7 @@ main (int argc, char ** argv)
 
 	  if (stat (argv[i], &sib) == 0)
 	    {
-	      if (sib.st_ino == sob.st_ino)
+	      if (sib.st_ino == sob.st_ino && sib.st_ino != 0)
 		{
 		  /* Don't let as_fatal remove the output file!  */
 		  out_file_name = NULL;



More information about the Binutils-cvs mailing list