From 26d78ae2210b759029117ea30252c32bb31d78fa Mon Sep 17 00:00:00 2001 From: jilles Date: Sat, 8 Dec 2012 17:41:39 +0000 Subject: time: Use close-on-exec instead of fclose() in the child process. --- usr.bin/time/time.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'usr.bin/time') diff --git a/usr.bin/time/time.c b/usr.bin/time/time.c index ebee542..c2ea522 100644 --- a/usr.bin/time/time.c +++ b/usr.bin/time/time.c @@ -112,7 +112,7 @@ main(int argc, char **argv) argv += optind; if (ofn) { - if ((out = fopen(ofn, aflag ? "a" : "w")) == NULL) + if ((out = fopen(ofn, aflag ? "ae" : "we")) == NULL) err(1, "%s", ofn); setvbuf(out, (char *)NULL, _IONBF, (size_t)0); } @@ -123,8 +123,6 @@ main(int argc, char **argv) err(1, "time"); /* NOTREACHED */ case 0: /* child */ - if (ofn) - fclose(out); execvp(*argv, argv); err(errno == ENOENT ? 127 : 126, "%s", *argv); /* NOTREACHED */ -- cgit v1.1