From: Paul Eggert Date: Fri, 14 Feb 2025 21:01:35 +0000 (-0800) Subject: cat: omit unnecessary lseek X-Git-Tag: v9.7~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dff821d3e392d7ac39c44eb5ded43ea91ced92f2;p=thirdparty%2Fcoreutils.git cat: omit unnecessary lseek * src/cat.c (main): Don’t bother to try lseek on a fifo or socket, as it will fail. --- diff --git a/src/cat.c b/src/cat.c index 92773d354f..274f844a16 100644 --- a/src/cat.c +++ b/src/cat.c @@ -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) {