From 6657cba5c89f6e5865970c92cf1b035337b48cab Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Wed, 9 Dec 2015 18:12:39 +0000 Subject: [PATCH] Plot: minor fix in temporary file management --- lib/Plot.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/Plot.cpp b/lib/Plot.cpp index eb4f79a..0e1f0e9 100644 --- a/lib/Plot.cpp +++ b/lib/Plot.cpp @@ -65,14 +65,14 @@ void PlotObject::pushTmpFile(const std::string &fileName) // PlotObject dump a matrix to a temporary file //////////////////////////////// string PlotObject::dumpToTmpFile(const DMat &m) { - char tmpFileName[MAX_PATH_LENGTH]; - int fd; - FILE *tmpFile; + char tmpFileName[MAX_PATH_LENGTH]; + int fd; + FILE *tmpFile; for (Index j = 0; j < m.cols(); ++j) { } - strcpy(tmpFileName, "/tmp/latan_plot_tmp.XXXXXX.dat"); + sprintf(tmpFileName, "%s/latan_plot_tmp.XXXXXX.dat", P_tmpdir); fd = mkstemps(tmpFileName, 4); if (fd == -1) { @@ -384,6 +384,7 @@ void Plot::reset(void) { headCommand_.clear(); plotCommand_.clear(); + tmpFileName_.clear(); initOptions(); }