summaryrefslogtreecommitdiffstats
path: root/runtime/staprun/relay_old.c
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/staprun/relay_old.c')
-rw-r--r--runtime/staprun/relay_old.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/runtime/staprun/relay_old.c b/runtime/staprun/relay_old.c
index 3f65acbb..f138aee5 100644
--- a/runtime/staprun/relay_old.c
+++ b/runtime/staprun/relay_old.c
@@ -86,7 +86,7 @@ static int open_relayfs_files(int cpu, const char *relay_filebase, const char *p
return -1;
dbug(2, "Opening %s.\n", tmp);
relay_fd[cpu] = open(tmp, O_RDONLY | O_NONBLOCK);
- if (relay_fd[cpu] < 0) {
+ if (relay_fd[cpu] < 0 || set_clexec(relay_fd[cpu]) < 0) {
relay_fd[cpu] = 0;
return 0;
}
@@ -99,6 +99,10 @@ static int open_relayfs_files(int cpu, const char *relay_filebase, const char *p
perr("Couldn't open proc file %s", tmp);
goto err1;
}
+ if (set_clexec(relay_fd[cpu]) < 0) {
+ relay_fd[cpu] = 0;
+ return -1;
+ }
if (outfile_name) {
/* special case: for testing we sometimes want to
@@ -118,6 +122,10 @@ static int open_relayfs_files(int cpu, const char *relay_filebase, const char *p
perr("Couldn't open output file %s", tmp);
goto err2;
}
+ if (set_clexec(fileno(percpu_tmpfile[cpu])) < 0) {
+ perr("Couldn't open output file %s", tmp);
+ goto err2;
+ }
total_bufsize = subbuf_size * n_subbufs;
relay_buffer[cpu] = mmap(NULL, total_bufsize, PROT_READ,
@@ -243,7 +251,7 @@ int init_oldrelayfs(void)
if (!bulkmode) {
if (outfile_name) {
out_fd[0] = open (outfile_name, O_CREAT|O_TRUNC|O_WRONLY, 0666);
- if (out_fd[0] < 0) {
+ if (out_fd[0] < 0 || set_clexec(out_fd[0]) < 0) {
perr("Couldn't open output file '%s'", outfile_name);
return -1;
}