From 28e13bf4d4e37a066618cc1c4760df6a178b9225 Mon Sep 17 00:00:00 2001 From: Keith Bostic Date: Mon, 4 May 1987 23:34:20 -0800 Subject: [PATCH] bug report 4.2BSD/bin/172 SCCS-vsn: old/awk/run.c 4.6 --- usr/src/old/awk/run.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/usr/src/old/awk/run.c b/usr/src/old/awk/run.c index 7486a73019..533b634a92 100644 --- a/usr/src/old/awk/run.c +++ b/usr/src/old/awk/run.c @@ -1,11 +1,12 @@ #ifndef lint -static char sccsid[] = "@(#)run.c 4.5 %G%"; +static char sccsid[] = "@(#)run.c 4.6 %G%"; #endif #include "awk.def" -#include "math.h" +#include "math.h" #include "awk.h" #include "stdio.h" +#include "fcntl.h" #define RECSIZE BUFSIZ #define FILENUM 10 @@ -873,6 +874,8 @@ redirprint(s, a, b) char *s; node *b; files[i].fp = fopen(x.optr->sval, "w"); if (files[i].fp == NULL) error(FATAL, "can't open file %s", x.optr->sval); + if (fcntl(fileno(files[i].fp), F_SETFD, 1) < 0) + error(FATAL, "close on exec failure"); files[i].fname = tostring(x.optr->sval); files[i].type = a; doit: -- 2.20.1