summaryrefslogtreecommitdiffstats
path: root/usr.bin/grep/binary.c
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2004-05-06 20:18:51 +0000
committerotto <otto@openbsd.org>2004-05-06 20:18:51 +0000
commit696c8bf3377a666c27266187c92ff3739a2e9696 (patch)
tree0a0c51377990ee216fa54ea1fc10724935342d5d /usr.bin/grep/binary.c
parentTypo (diff)
downloadwireguard-openbsd-696c8bf3377a666c27266187c92ff3739a2e9696.tar.xz
wireguard-openbsd-696c8bf3377a666c27266187c92ff3739a2e9696.zip
Don't fseek() on stdin if it is a terminal. It does not fail, but
what's more more important, it does not work either. ok millert@ tedu@
Diffstat (limited to 'usr.bin/grep/binary.c')
-rw-r--r--usr.bin/grep/binary.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/grep/binary.c b/usr.bin/grep/binary.c
index 8174b926272..3c8bcd63000 100644
--- a/usr.bin/grep/binary.c
+++ b/usr.bin/grep/binary.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: binary.c,v 1.11 2004/05/06 19:42:16 millert Exp $ */
+/* $OpenBSD: binary.c,v 1.12 2004/05/06 20:18:51 otto Exp $ */
/*-
* Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
@@ -41,7 +41,7 @@ bin_file(FILE *f)
int i, m;
int ret = 0;
- if (fseek(f, 0L, SEEK_SET) == -1)
+ if (isatty(fileno(f)) || fseek(f, 0L, SEEK_SET) == -1)
return 0;
if ((m = (int)fread(buf, 1, BUFSIZ, f)) == 0)