From e1d27f08f1f653bc853d71278711b6c9a49b8867 Mon Sep 17 00:00:00 2001 From: Eivind Eklund Date: Wed, 1 Jun 2005 20:34:06 +0000 Subject: [PATCH] Back out revision 1.19 and 1.20 until I find mental clarity to deal with issues bde pointed out. --- usr.bin/tail/tail.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/usr.bin/tail/tail.c b/usr.bin/tail/tail.c index fa1e8f6e1f74..9162d1712ba7 100644 --- a/usr.bin/tail/tail.c +++ b/usr.bin/tail/tail.c @@ -219,7 +219,13 @@ main(int argc, char *argv[]) exit(1); } - if ((sb.st_mode & S_IFMT) == S_IFSOCK || (sb.st_mode & S_IFMT) == S_IFIFO) { + /* + * Determine if input is a pipe. 4.4BSD will set the SOCKET + * bit in the st_mode field for pipes. Fix this then. + */ + if (lseek(fileno(stdin), (off_t)0, SEEK_CUR) == -1 && + errno == ESPIPE) { + errno = 0; fflag = 0; /* POSIX.2 requires this. */ }