PR gdb/7912:
[deliverable/binutils-gdb.git] / gdb / tracepoint.c
index 212fe59ef6411d5ec927b6eab9165c7b0b091478..f5c9c4968202af8717e5fa37fbc05e47771eef69 100644 (file)
@@ -55,6 +55,7 @@
 #include "probe.h"
 #include "ctf.h"
 #include "completer.h"
+#include "filestuff.h"
 
 /* readline include files */
 #include "readline/readline.h"
@@ -3066,7 +3067,7 @@ tfile_start (struct trace_file_writer *self, const char *filename)
     = (struct tfile_trace_file_writer *) self;
 
   writer->pathname = tilde_expand (filename);
-  writer->fp = fopen (writer->pathname, "wb");
+  writer->fp = gdb_fopen_cloexec (writer->pathname, "wb");
   if (writer->fp == NULL)
     error (_("Unable to open file '%s' for saving trace data (%s)"),
           filename, safe_strerror (errno));
@@ -3340,8 +3341,6 @@ trace_save (const char *filename, struct trace_file_writer *writer,
      target is losing, we can get out without touching files.  */
   status = target_get_trace_status (ts);
 
-  writer->ops->start (writer, filename);
-
   writer->ops->write_header (writer);
 
   /* Write descriptive info.  */
@@ -4198,7 +4197,7 @@ tfile_open (char *filename, int from_tty)
 
   flags = O_BINARY | O_LARGEFILE;
   flags |= O_RDONLY;
-  scratch_chan = open (filename, flags, 0);
+  scratch_chan = gdb_open_cloexec (filename, flags, 0);
   if (scratch_chan < 0)
     perror_with_name (filename);
 
This page took 0.025529 seconds and 4 git commands to generate.