diff options
Diffstat (limited to 'rtemstoolkit/rld-path.cpp')
-rw-r--r-- | rtemstoolkit/rld-path.cpp | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/rtemstoolkit/rld-path.cpp b/rtemstoolkit/rld-path.cpp index 35af055..61c954d 100644 --- a/rtemstoolkit/rld-path.cpp +++ b/rtemstoolkit/rld-path.cpp @@ -109,23 +109,13 @@ namespace rld } else { - char* buf = 0; - try + std::vector<char> buf (32 * 1024); + if (!::getcwd (buf.data(), buf.size())) { - buf = new char[32 * 1024]; - if (!::getcwd (buf, 32 * 1024)) - { - delete [] buf; - throw rld::error (::strerror (errno), "get current working directory"); - } - path_join (buf, path, apath); - delete [] buf; - } - catch (...) - { - delete [] buf; - throw; + throw rld::error (::strerror (errno), "get current working directory"); } + std::string cwd (buf.data()); + path_join (cwd, path, apath); } strings ps; |