# HG changeset patch # User Paper # Date 1700287922 18000 # Node ID 8937fb7f2d66889b5fcbf43ea58d43784af50b60 # Parent 99fdf5a90b0f8a8a4c58c1c06a064a067495cc88 dep/animia/osx: that's not how std::string works diff -r 99fdf5a90b0f -r 8937fb7f2d66 dep/animia/src/util/osx.cc --- a/dep/animia/src/util/osx.cc Sat Nov 18 00:54:29 2023 -0500 +++ b/dep/animia/src/util/osx.cc Sat Nov 18 01:12:02 2023 -0500 @@ -146,11 +146,13 @@ } static bool GetProcessNameFromKernel(pid_t pid, std::string& result) { - result.reserve(2*MAXCOMLEN); - if (!proc_name(pid, &result.front(), result.length())) + result.resize(2 * MAXCOMLEN); + + int size = proc_name(pid, &result.front(), result.length()); + if (!size) return false; - result.shrink_to_fit(); + result.resize(size); return true; }