summaryrefslogtreecommitdiffstats
path: root/usr.bin/truss/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/truss/main.c')
-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 b9dcfe4..d25c4de 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 --
OpenPOWER on IntegriCloud