summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorJose Fonseca <jfonseca@vmware.com>2014-12-17 11:57:20 +0000
committerJose Fonseca <jfonseca@vmware.com>2014-12-17 11:57:20 +0000
commitf0e6d8bde961683b7862b4eb0bb04c49d9699f3c (patch)
treed064f3b795b3dfbf8cbe6bc288a79d9e4e97e8de /cli
parent2b761dbeebac9126947315659419a0fb1f80b230 (diff)
cli: Use mkstemp instead of mktemp.
Diffstat (limited to 'cli')
-rw-r--r--cli/cli_trace.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/cli/cli_trace.cpp b/cli/cli_trace.cpp
index 127eaabe..b543b1e9 100644
--- a/cli/cli_trace.cpp
+++ b/cli/cli_trace.cpp
@@ -195,15 +195,15 @@ traceProgram(trace::API api,
*/
char scriptFileName[] = "/tmp/apitrace.XXXXXX";
- if (mktemp(scriptFileName) == NULL) {
+ int scriptFD = mkstemp(scriptFileName);
+ if (scriptFD < 0) {
std::cerr << "error: failed to create temporary lldb script file\n";
exit(1);
}
- {
- std::ofstream scriptStream(scriptFileName);
- scriptStream << "env " TRACE_VARIABLE "='" << wrapperPath.str() << "'\n";
- }
+ FILE *scriptStream = fdopen(scriptFD, "w");
+ fprintf(scriptStream, "env " TRACE_VARIABLE "='%s'\n", wrapperPath.str());
+ fclose(scriptStream);
args.push_back("lldb");
args.push_back("-s");