diff options
author | jilles <jilles@FreeBSD.org> | 2012-12-08 17:41:39 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2012-12-08 17:41:39 +0000 |
commit | 26d78ae2210b759029117ea30252c32bb31d78fa (patch) | |
tree | a808e48032b28cd03d3641724ad84dadab396a6b /usr.bin/time | |
parent | 9194fa58873d334119293006b535fddce62b2ab7 (diff) | |
download | FreeBSD-src-26d78ae2210b759029117ea30252c32bb31d78fa.zip FreeBSD-src-26d78ae2210b759029117ea30252c32bb31d78fa.tar.gz |
time: Use close-on-exec instead of fclose() in the child process.
Diffstat (limited to 'usr.bin/time')
-rw-r--r-- | usr.bin/time/time.c | 4 |
1 files changed, 1 insertions, 3 deletions
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 */ |