svn commit: r245957 - head/usr.bin/truss
Mateusz Guzik
mjg at FreeBSD.org
Sun Jan 27 03:17:36 UTC 2013
Author: mjg
Date: Sun Jan 27 03:17:35 2013
New Revision: 245957
URL: http://svnweb.freebsd.org/changeset/base/245957
Log:
truss: use 'e' flag for fopen instead of fcntl(.., FD_CLOEXEC)
Modified:
head/usr.bin/truss/main.c
Modified: head/usr.bin/truss/main.c
==============================================================================
--- head/usr.bin/truss/main.c Sun Jan 27 03:14:54 2013 (r245956)
+++ head/usr.bin/truss/main.c Sun Jan 27 03:17:35 2013 (r245957)
@@ -234,15 +234,12 @@ main(int ac, char **av)
usage();
if (fname != NULL) { /* Use output file */
- if ((trussinfo->outfile = fopen(fname, "w")) == NULL)
- err(1, "cannot open %s", fname);
/*
- * Set FD_CLOEXEC, so that the output file is not shared with
- * the traced process.
+ * Set close-on-exec ('e'), so that the output file is not
+ * shared with the traced process.
*/
- if (fcntl(fileno(trussinfo->outfile), F_SETFD, FD_CLOEXEC) ==
- -1)
- warn("fcntl()");
+ if ((trussinfo->outfile = fopen(fname, "we")) == NULL)
+ err(1, "cannot open %s", fname);
}
/*
More information about the svn-src-all
mailing list