summaryrefslogtreecommitdiff
path: root/usr.bin/truss
diff options
context:
space:
mode:
authorJaakko Heinonen <jh@FreeBSD.org>2010-11-13 09:28:49 +0000
committerJaakko Heinonen <jh@FreeBSD.org>2010-11-13 09:28:49 +0000
commite04c3786831223dd5b746ab9c2a4fc03897e9b99 (patch)
treeb9179c9b7168608a1d05662c6a11501de6ebb23e /usr.bin/truss
parent231c8b7113dad6d7252ec7c97b9444084fe0ed93 (diff)
downloadsrc-test2-e04c3786831223dd5b746ab9c2a4fc03897e9b99.tar.gz
src-test2-e04c3786831223dd5b746ab9c2a4fc03897e9b99.zip
Notes
Diffstat (limited to 'usr.bin/truss')
-rw-r--r--usr.bin/truss/main.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/usr.bin/truss/main.c b/usr.bin/truss/main.c
index b9dcfe4e7fec..d25c4de1be34 100644
--- a/usr.bin/truss/main.c
+++ b/usr.bin/truss/main.c
@@ -241,13 +241,14 @@ main(int ac, char **av)
if (fname != NULL) { /* Use output file */
if ((trussinfo->outfile = fopen(fname, "w")) == NULL)
errx(1, "cannot open %s", fname);
+ /*
+ * Set FD_CLOEXEC, so that the output file is not shared with
+ * the traced process.
+ */
+ if (fcntl(fileno(trussinfo->outfile), F_SETFD, FD_CLOEXEC) ==
+ -1)
+ warn("fcntl()");
}
- /*
- * Set FD_CLOEXEC, 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 truss starts the process itself, it will ignore some signals --