diff options
author | mjg <mjg@FreeBSD.org> | 2013-01-27 03:17:35 +0000 |
---|---|---|
committer | mjg <mjg@FreeBSD.org> | 2013-01-27 03:17:35 +0000 |
commit | 5d55975eb2305796623c72048ac32393232fc9b2 (patch) | |
tree | 5456d50617a56a7b0fc15697cc4128961d2b7e69 /usr.bin/truss | |
parent | 1f183c28728c5adc2b77e3dcd95cb6abec4c4174 (diff) | |
download | FreeBSD-src-5d55975eb2305796623c72048ac32393232fc9b2.zip FreeBSD-src-5d55975eb2305796623c72048ac32393232fc9b2.tar.gz |
truss: use 'e' flag for fopen instead of fcntl(.., FD_CLOEXEC)
Diffstat (limited to 'usr.bin/truss')
-rw-r--r-- | usr.bin/truss/main.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/usr.bin/truss/main.c b/usr.bin/truss/main.c index 2b72c95..4e9f74b 100644 --- a/usr.bin/truss/main.c +++ b/usr.bin/truss/main.c @@ -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); } /* |