diff options
| author | Paul Eggert <eggert@cs.ucla.edu> | 2025-02-14 13:01:35 -0800 |
|---|---|---|
| committer | Paul Eggert <eggert@cs.ucla.edu> | 2025-02-14 13:13:08 -0800 |
| commit | dff821d3e392d7ac39c44eb5ded43ea91ced92f2 (patch) | |
| tree | 5a7c9de36698bbc74db832ee8e1b11b9ed119941 | |
| parent | cat: port to platforms with shm, tmo (diff) | |
| download | coreutils-dff821d3e392d7ac39c44eb5ded43ea91ced92f2.tar.gz coreutils-dff821d3e392d7ac39c44eb5ded43ea91ced92f2.zip | |
cat: omit unnecessary lseek
* src/cat.c (main): Don’t bother to try lseek on a fifo or socket,
as it will fail.
| -rw-r--r-- | src/cat.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -712,7 +712,8 @@ main (int argc, char **argv) output device. It's better to catch this error earlier rather than later. */ - if (! (S_TYPEISSHM (&stat_buf) || S_TYPEISTMO (&stat_buf)) + if (! (S_ISFIFO (stat_buf.st_mode) || S_ISSOCK (stat_buf.st_mode) + || S_TYPEISSHM (&stat_buf) || S_TYPEISTMO (&stat_buf)) && have_out_dev && stat_buf.st_dev == out_dev && stat_buf.st_ino == out_ino) { |
