diff options
-rw-r--r-- | usr.bin/awk/run.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/awk/run.c b/usr.bin/awk/run.c index 4ba6c79eac1..a826182672e 100644 --- a/usr.bin/awk/run.c +++ b/usr.bin/awk/run.c @@ -1,4 +1,4 @@ -/* $OpenBSD: run.c,v 1.63 2020/07/02 19:06:22 millert Exp $ */ +/* $OpenBSD: run.c,v 1.64 2020/07/20 18:55:15 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -1977,8 +1977,12 @@ void closeall(void) continue; if (ferror(files[i].fp)) FATAL( "i/o error occurred on %s", files[i].fname ); + if (files[i].fp == stdin) + continue; if (files[i].mode == '|' || files[i].mode == LE) stat = pclose(files[i].fp) == -1; + else if (files[i].fp == stdout || files[i].fp == stderr) + stat = fflush(files[i].fp) == EOF; else stat = fclose(files[i].fp) == EOF; if (stat) |