| 1330 | } |
| 1331 | |
| 1332 | static std::string read_symlink(std::string const& symlink_path) |
| 1333 | { |
| 1334 | std::string path; |
| 1335 | path.resize(100); |
| 1336 | |
| 1337 | while (true) { |
| 1338 | ssize_t len = ::readlink(symlink_path.c_str(), &*path.begin(), path.size()); |
| 1339 | if (len < 0) { |
| 1340 | return ""; |
| 1341 | } |
| 1342 | if (static_cast<size_t>(len) == path.size()) { |
| 1343 | path.resize(path.size() * 2); |
| 1344 | } |
| 1345 | else { |
| 1346 | path.resize(static_cast<std::string::size_type>(len)); |
| 1347 | break; |
| 1348 | } |
| 1349 | } |
| 1350 | |
| 1351 | return path; |
| 1352 | } |
| 1353 | }; |
| 1354 | |
| 1355 | template <typename STACKTRACE_TAG> |