summaryrefslogtreecommitdiff
path: root/gas/as.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2020-03-06 10:44:12 +0000
committerNick Clifton <nickc@redhat.com>2020-03-06 10:44:12 +0000
commit3c968de5c7d1719b2f9b538f2f7f5f5922e5f311 (patch)
tree1b8d480e10ef3daec9459d1d97ef6aee90bea959 /gas/as.c
parenta0dcf2970562c19140460a07b2c987714639cd7b (diff)
downloadbinutils-gdb-3c968de5c7d1719b2f9b538f2f7f5f5922e5f311.tar.gz
Stop the assembler from complaining that the input and output files are the same, if neither of them are regular files.
PR 25572 * as.c (main): Allow matching input and outputs when they are not regular files.
Diffstat (limited to 'gas/as.c')
-rw-r--r--gas/as.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gas/as.c b/gas/as.c
index d8d20cca76f..51bb7210ec8 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -1290,7 +1290,13 @@ main (int argc, char ** argv)
/* Different files may have the same inode number if they
reside on different devices, so check the st_dev field as
well. */
- && sib.st_dev == sob.st_dev)
+ && sib.st_dev == sob.st_dev
+ /* PR 25572: Only check regular files. Devices, sockets and so
+ on might actually work as both input and output. Plus there
+ is a use case for using /dev/null as both input and output
+ when checking for command line option support in a script:
+ as --foo /dev/null -o /dev/null; if $? then ... */
+ && S_ISREG (sib.st_mode))
{
const char *saved_out_file_name = out_file_name;