Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/tail PR/50322: Timo Buhrmester: tail -F <file> misbe...
details: https://anonhg.NetBSD.org/src/rev/7416f4ff02be
branches: trunk
changeset: 340901:7416f4ff02be
user: christos <christos%NetBSD.org@localhost>
date: Fri Oct 09 17:51:26 2015 +0000
description:
PR/50322: Timo Buhrmester: tail -F <file> misbehaves with stdin closed
Compare fp with stdin not fileno(fp) with STDIN_FILENO, because if tail
is called with 0 closed, then we are not going to be setting event filters
for the file because we'll erroneously think it is stdin.
diffstat:
usr.bin/tail/forward.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (36 lines):
diff -r 2098cb3cfff1 -r 7416f4ff02be usr.bin/tail/forward.c
--- a/usr.bin/tail/forward.c Fri Oct 09 17:22:44 2015 +0000
+++ b/usr.bin/tail/forward.c Fri Oct 09 17:51:26 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: forward.c,v 1.32 2013/10/18 20:47:07 christos Exp $ */
+/* $NetBSD: forward.c,v 1.33 2015/10/09 17:51:26 christos Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)forward.c 8.1 (Berkeley) 6/6/93";
#endif
-__RCSID("$NetBSD: forward.c,v 1.32 2013/10/18 20:47:07 christos Exp $");
+__RCSID("$NetBSD: forward.c,v 1.33 2015/10/09 17:51:26 christos Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -198,7 +198,7 @@
n = 0;
memset(ev, 0, sizeof(ev));
- if (fflag == 2 && fileno(fp) != STDIN_FILENO) {
+ if (fflag == 2 && fp != stdin) {
EV_SET(&ev[n], fileno(fp), EVFILT_VNODE,
EV_ADD | EV_ENABLE | EV_CLEAR,
NOTE_DELETE | NOTE_RENAME, 0, 0);
@@ -240,7 +240,7 @@
*/
(void) sleep(1);
- if (fflag == 2 && fileno(fp) != STDIN_FILENO &&
+ if (fflag == 2 && fp != stdin &&
stat(fname, &statbuf) != -1) {
if (statbuf.st_ino != sbp->st_ino ||
statbuf.st_dev != sbp->st_dev ||
Home |
Main Index |
Thread Index |
Old Index