This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/2 V3] gas/as.c: compare device id


Different files may have the same inode number on different devices, for
example:

$ cat foo.c | gcc -x c - -o /dev/null

In this case, gcc will create a /tmp/foo.s, and if /tmp is a tmpfs, foo.s' ino
starts from a small number such 3, and /dev/null's ino is also small (e.g., 6),
so this is very likely to happen when there are many gcc's runs.

Compare device id will fix the problem.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 gas/as.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gas/as.c b/gas/as.c
index 512ad59..92a49c9 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -1257,7 +1257,7 @@ main (int argc, char ** argv)
 
 	  if (stat (argv[i], &sib) == 0)
 	    {
-	      if (sib.st_ino == sob.st_ino && sib.st_ino != 0)
+	      if (sib.st_ino == sob.st_ino && sib.st_ino != 0 && sib.st_dev == sob.st_dev)
 		{
 		  saved_out_file_name = out_file_name;
 		  /* Don't let as_fatal remove the output file!  */
-- 
2.7.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]