[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/2] gas/as.c: compare device id
From: |
Robert Yang |
Subject: |
[PATCH 2/2] gas/as.c: compare device id |
Date: |
Thu, 9 Aug 2018 11:38:25 +0800 |
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 <address@hidden>
---
gas/as.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gas/as.c b/gas/as.c
index 6afe9a5..becc7d2 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 && sib.st_ino != 0)
+ if (sib.st_ino == sob.st_ino && sib.st_ino != 0 && sib.st_dev ==
sib.st_dev)
{
/* Don't let as_fatal remove the output file! */
saved_out_file_name = xstrdup (out_file_name);
--
2.7.4