svn commit: r244034 - head/usr.bin/time
Jilles Tjoelker
jilles at FreeBSD.org
Sat Dec 8 17:41:40 UTC 2012
Author: jilles
Date: Sat Dec 8 17:41:39 2012
New Revision: 244034
URL: http://svnweb.freebsd.org/changeset/base/244034
Log:
time: Use close-on-exec instead of fclose() in the child process.
Modified:
head/usr.bin/time/time.c
Modified: head/usr.bin/time/time.c
==============================================================================
--- head/usr.bin/time/time.c Sat Dec 8 15:11:09 2012 (r244033)
+++ head/usr.bin/time/time.c Sat Dec 8 17:41:39 2012 (r244034)
@@ -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 */
More information about the svn-src-head
mailing list