truss: use 'e' flag for fopen instead of fcntl(.., FD_CLOEXEC)

This commit is contained in:
Mateusz Guzik 2013-01-27 03:17:35 +00:00
parent 8ff44cbb80
commit c2b51d4457
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=245957

View File

@ -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);
}
/*