mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
Don't reopen file if its stdin.
From leo_tck at volny dot cz OK millert@
This commit is contained in:
parent
d2d19ac182
commit
93757356f5
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: extern.h,v 1.12 2015/11/19 17:50:04 tedu Exp $ */
|
||||
/* $OpenBSD: extern.h,v 1.13 2019/01/04 15:04:28 martijn Exp $ */
|
||||
/* $NetBSD: extern.h,v 1.3 1994/11/23 07:42:00 jtc Exp $ */
|
||||
|
||||
/*-
|
||||
@ -55,4 +55,3 @@ void oerr(void);
|
||||
void printfname(const char *);
|
||||
|
||||
extern int fflag, rflag, rval;
|
||||
extern int is_stdin;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: forward.c,v 1.31 2016/07/05 05:06:27 jsg Exp $ */
|
||||
/* $OpenBSD: forward.c,v 1.32 2019/01/04 15:04:28 martijn Exp $ */
|
||||
/* $NetBSD: forward.c,v 1.7 1996/02/13 16:49:10 ghudson Exp $ */
|
||||
|
||||
/*-
|
||||
@ -335,7 +335,8 @@ tfreopen(struct tailfile *tf) {
|
||||
struct tailfile **treopen, *ttf;
|
||||
int i;
|
||||
|
||||
if (tf && ((stat(tf->fname, &sb) != 0) || sb.st_ino != tf->sb.st_ino)) {
|
||||
if (tf && !(tf->fp == stdin) &&
|
||||
((stat(tf->fname, &sb) != 0) || sb.st_ino != tf->sb.st_ino)) {
|
||||
if (afiles < ++nfiles) {
|
||||
afiles += AFILESINCR;
|
||||
treopen = reallocarray(reopen, afiles, sizeof(*reopen));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: tail.c,v 1.21 2016/02/03 12:23:57 halex Exp $ */
|
||||
/* $OpenBSD: tail.c,v 1.22 2019/01/04 15:04:28 martijn Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -45,7 +45,6 @@
|
||||
#include "extern.h"
|
||||
|
||||
int fflag, rflag, rval;
|
||||
int is_stdin;
|
||||
|
||||
static void obsolete(char **);
|
||||
static void usage(void);
|
||||
@ -173,7 +172,6 @@ main(int argc, char *argv[])
|
||||
|
||||
tf[0].fname = "stdin";
|
||||
tf[0].fp = stdin;
|
||||
is_stdin = 1;
|
||||
|
||||
if (fstat(fileno(stdin), &(tf[0].sb))) {
|
||||
ierr(tf[0].fname);
|
||||
|
Loading…
Reference in New Issue
Block a user