# HG changeset patch # User Paper # Date 1705324258 18000 # Node ID 0a5b6a088886d04593d847b13d9868e424435d17 # Parent ff0061e75f0f6e2f8b509784abaf871f3bd0b4c0 dep/animia: fix proc readlink diff -r ff0061e75f0f -r 0a5b6a088886 dep/animia/src/fd/proc.cc --- a/dep/animia/src/fd/proc.cc Sat Jan 13 11:06:16 2024 -0500 +++ b/dep/animia/src/fd/proc.cc Mon Jan 15 08:10:58 2024 -0500 @@ -7,6 +7,8 @@ #include #include +#include + #include #include #include @@ -56,13 +58,13 @@ out.resize(32); ssize_t exe_used = 0; - while (out.length() < OUT_MAX && exe_used >= static_cast(out.length())) { + do { out.resize(out.length() * 2); exe_used = readlink(link.c_str(), &out.front(), out.length()); if (exe_used == (ssize_t)-1 || exe_used < (ssize_t)1) return false; // we got a bad result. SAD! - } + } while (out.length() < OUT_MAX && exe_used >= static_cast(out.length())); out.resize(out.find('\0'));