mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 20:50:33 +00:00
Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into next
This commit is contained in:
commit
c159157f22
@ -25,6 +25,7 @@
|
|||||||
#include <iostream> // for operator<<, basic_ostream, endl, char...
|
#include <iostream> // for operator<<, basic_ostream, endl, char...
|
||||||
#include <fstream> // IWYU pragma: keep
|
#include <fstream> // IWYU pragma: keep
|
||||||
#include <map> // for map, map<>::iterator, _Rb_tree_iterator
|
#include <map> // for map, map<>::iterator, _Rb_tree_iterator
|
||||||
|
#include <sstream> // for stringstream
|
||||||
#include <string> // for string, operator<<
|
#include <string> // for string, operator<<
|
||||||
#include <utility> // for pair
|
#include <utility> // for pair
|
||||||
#include <vector> // for vector
|
#include <vector> // for vector
|
||||||
@ -48,15 +49,16 @@ int main(int argc, char* argv[])
|
|||||||
std::vector<volk_gnsssdr_test_results_t> results;
|
std::vector<volk_gnsssdr_test_results_t> results;
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
{
|
{
|
||||||
const size_t len = std::char_traits<char>::length(argv[1]);
|
std::stringstream ss;
|
||||||
if (len == 0 || len > 2046)
|
ss << argv[1];
|
||||||
|
if (ss.fail())
|
||||||
{
|
{
|
||||||
std::cerr << "Test name is too long." << std::endl;
|
std::cerr << "Test name not correctly set." << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
for (unsigned int ii = 0; ii < test_cases.size(); ++ii)
|
for (unsigned int ii = 0; ii < test_cases.size(); ++ii)
|
||||||
{
|
{
|
||||||
if (std::string(argv[1]) == test_cases[ii].name())
|
if (ss.str() == test_cases[ii].name())
|
||||||
{
|
{
|
||||||
volk_gnsssdr_test_case_t test_case = test_cases[ii];
|
volk_gnsssdr_test_case_t test_case = test_cases[ii];
|
||||||
if (run_volk_gnsssdr_tests(test_case.desc(), test_case.kernel_ptr(),
|
if (run_volk_gnsssdr_tests(test_case.desc(), test_case.kernel_ptr(),
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
#include <cstring> // for strncpy
|
#include <cstring> // for strncpy
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <list> // for std::list
|
#include <list> // for std::list
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
|
||||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__)
|
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__)
|
||||||
@ -1960,21 +1961,16 @@ bool Gnuplot::get_program_path()
|
|||||||
//
|
//
|
||||||
// second look in PATH for Gnuplot
|
// second look in PATH for Gnuplot
|
||||||
//
|
//
|
||||||
char *path;
|
const char *path;
|
||||||
// Retrieves a C string containing the value of environment variable PATH
|
// Retrieves a C string containing the value of environment variable PATH
|
||||||
path = std::getenv("PATH");
|
path = std::getenv("PATH");
|
||||||
char secured_path[4096];
|
std::stringstream s;
|
||||||
size_t len = strlen(path);
|
s << path;
|
||||||
if (len > 0 && len < 4046 * sizeof(char))
|
if (s.fail())
|
||||||
{
|
{
|
||||||
strncpy(secured_path, path, sizeof(secured_path));
|
throw GnuplotException("Path is not set");
|
||||||
}
|
}
|
||||||
else
|
std::string path_str = s.str();
|
||||||
{
|
|
||||||
throw GnuplotException("Path is not set or it is too long");
|
|
||||||
}
|
|
||||||
secured_path[len] = '\0';
|
|
||||||
std::string path_str(secured_path);
|
|
||||||
|
|
||||||
std::list<std::string> ls;
|
std::list<std::string> ls;
|
||||||
|
|
||||||
@ -2106,17 +2102,24 @@ std::string Gnuplot::create_tmpfile(std::ofstream &tmp)
|
|||||||
//
|
//
|
||||||
// open temporary files for output
|
// open temporary files for output
|
||||||
//
|
//
|
||||||
|
|
||||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__)
|
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__)
|
||||||
if (_mktemp(name) == NULL)
|
if (_mktemp(name) == NULL)
|
||||||
#elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
|
#elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
|
||||||
|
mode_t mask = umask(S_IXUSR | S_IRWXG | S_IRWXO);
|
||||||
if (mkstemp(name) == -1)
|
if (mkstemp(name) == -1)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
std::ostringstream except;
|
std::ostringstream except;
|
||||||
except << "Cannot create temporary file \"" << name << "\"";
|
except << "Cannot create temporary file \"" << name << "\"";
|
||||||
|
#if defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
|
||||||
|
umask(mask);
|
||||||
|
#endif
|
||||||
throw GnuplotException(except.str());
|
throw GnuplotException(except.str());
|
||||||
}
|
}
|
||||||
|
#if defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
|
||||||
|
umask(mask);
|
||||||
|
#endif
|
||||||
tmp.open(name);
|
tmp.open(name);
|
||||||
if (tmp.bad())
|
if (tmp.bad())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user