From: Joel Rosdahl Date: Tue, 29 Dec 2020 18:33:54 +0000 (+0100) Subject: Remove obsolete (and now incorrect) fallback replacement of realpath(3) X-Git-Tag: v4.2~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76eb7f4c46e876db07bbc8fa850b7d84a480c5ea;p=thirdparty%2Fccache.git Remove obsolete (and now incorrect) fallback replacement of realpath(3) The fallback replacement of realpath(3) (from 8e918ccc) uses readlink(3) under the assumption that we’re only interested about symlinks, but that’s no longer the case: we’re using it for normalization purposes as well. Let’s just remove it. If it turns out that there still are non-Windows systems that don’t have realpath(3) and that we care about we’ll figure out something else. --- diff --git a/src/Util.cpp b/src/Util.cpp index 2aaaa0a82..edeba4232 100644 --- a/src/Util.cpp +++ b/src/Util.cpp @@ -1245,15 +1245,7 @@ real_path(const std::string& path, bool return_empty_on_error) resolved = buffer; } #else - // Yes, there are such systems. This replacement relies on the fact that when - // we call x_realpath we only care about symlinks. - { - ssize_t len = readlink(path.c_str(), buffer, buffer_size - 1); - if (len != -1) { - buffer[len] = 0; - resolved = buffer; - } - } +# error No realpath function available #endif return resolved ? resolved : (return_empty_on_error ? "" : path);