diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2007-03-22 18:35:08 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2007-03-22 18:35:08 +0000 |
commit | f9e584fecc780db62419710ae151a2ae5233d695 (patch) | |
tree | e67b171666917333e77664030206f262404fa1cc /bin | |
parent | 52fb9a580b4c558cfea9160e8c05c4f8fce48fd3 (diff) |
Fix handling of multiple stdin arguments in cooked mode, closes PR 5418.
From Johan Veenhuizen
Diffstat (limited to 'bin')
-rw-r--r-- | bin/cat/cat.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/cat/cat.c b/bin/cat/cat.c index 27e29ab6049..07f9d3c3899 100644 --- a/bin/cat/cat.c +++ b/bin/cat/cat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cat.c,v 1.17 2005/04/05 01:18:53 jaredy Exp $ */ +/* $OpenBSD: cat.c,v 1.18 2007/03/22 18:35:07 millert Exp $ */ /* $NetBSD: cat.c,v 1.11 1995/09/07 06:12:54 jtc Exp $ */ /* @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)cat.c 8.2 (Berkeley) 4/27/95"; #else -static char rcsid[] = "$OpenBSD: cat.c,v 1.17 2005/04/05 01:18:53 jaredy Exp $"; +static char rcsid[] = "$OpenBSD: cat.c,v 1.18 2007/03/22 18:35:07 millert Exp $"; #endif #endif /* not lint */ @@ -139,7 +139,9 @@ cook_args(char **argv) filename = *argv++; } cook_buf(fp); - if (fp != stdin) + if (fp == stdin) + clearerr(fp); + else (void)fclose(fp); } while (*argv); } |