diff options
author | Jim Meyering <jim@meyering.net> | 1995-11-11 14:21:15 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1995-11-11 14:21:15 +0000 |
commit | 24aec7f87ff14a3229d080007a77e1dc7ae79f2b (patch) | |
tree | 7ca93ac061803c9ed5349fbf8e0b5c8bdef34873 /src | |
parent | acb7c4ee4877c2261ef2abcb8bf00b73faa2f890 (diff) | |
download | coreutils-24aec7f87ff14a3229d080007a77e1dc7ae79f2b.tar.xz |
(main): Don't die when dev/ino of input and output are
the same and the file descriptors correspond to stdin and stdout.
This is necessary on at least Digital UNIX (aka OSF1) 3.2C.
Otherwise, running `cat << X > $$' would fail with `cat: -: input
file is output file'. From Jarkko Hietaniemi <jhi@epsilon.hut.fi>.
Diffstat (limited to 'src')
-rw-r--r-- | src/cat.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -654,7 +654,8 @@ main (int argc, char **argv) files cannot be redirected to themselves. */ if (check_redirection - && stat_buf.st_dev == out_dev && stat_buf.st_ino == out_ino) + && stat_buf.st_dev == out_dev && stat_buf.st_ino == out_ino + && (input_desc != fileno (stdin) || output_desc != fileno (stdout))) { error (0, 0, _("%s: input file is output file"), infile); exit_stat = 1; |