Mercurial > minori
changeset 233:0a5b6a088886
dep/animia: fix proc readlink
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Mon, 15 Jan 2024 08:10:58 -0500 |
parents | ff0061e75f0f |
children | 8ccf0302afb1 |
files | dep/animia/src/fd/proc.cc |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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 <sstream> #include <string> +#include <iostream> + #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> @@ -56,13 +58,13 @@ out.resize(32); ssize_t exe_used = 0; - while (out.length() < OUT_MAX && exe_used >= static_cast<ssize_t>(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<ssize_t>(out.length())); out.resize(out.find('\0'));