]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Remove obsolete (and now incorrect) fallback replacement of realpath(3)
authorJoel Rosdahl <joel@rosdahl.net>
Tue, 29 Dec 2020 18:33:54 +0000 (19:33 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 29 Dec 2020 19:37:52 +0000 (20:37 +0100)
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.

src/Util.cpp

index 2aaaa0a82b4a8479dcc3cf463dc5bf312360a635..edeba42325df1b4bd1d3084a3766ddcf8cd08af9 100644 (file)
@@ -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);