diff options
author | Josh Blum <josh@joshknows.com> | 2016-08-06 21:32:33 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2016-08-06 21:32:33 -0700 |
commit | 6dade06d39719b0a6d611e02b144998312c6c6da (patch) | |
tree | 6075f1249c35eb8ef2f03d6712ec10a6e5828167 | |
parent | 93e1b89c07ba37855a3e022ac311268d1ed5728f (diff) |
fix temporary variable return in userconf_path()
This fix provides an internal userconf_path() implementation
that provides the path as a string. The path is actually stored
in the real userconf_path() within a static variable making it
safe to return a char * pointer from this static string.
-rw-r--r-- | gnuradio-runtime/lib/sys_paths.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gnuradio-runtime/lib/sys_paths.cc b/gnuradio-runtime/lib/sys_paths.cc index 3bf6697bac..f63d7730e4 100644 --- a/gnuradio-runtime/lib/sys_paths.cc +++ b/gnuradio-runtime/lib/sys_paths.cc @@ -64,10 +64,16 @@ namespace gr { return tmp_path(); } - const char *userconf_path() + std::string __userconf_path() { boost::filesystem::path p(appdata_path()); p = p / ".gnuradio"; + return p.string(); + } + + const char *userconf_path() + { + static std::string p(__userconf_path()); return p.c_str(); } |