From f5dd7d3c7b1349b41bec520e7aaae4cda1ea2b3d Mon Sep 17 00:00:00 2001 From: Jessica Hamilton Date: Fri, 20 May 2022 16:08:35 +0000 Subject: [PATCH] libroot_build: fix stat of files in a symlinked directory Only manifested itself with the host build tools, where looking up a file inside a directory that is a symlink would fail, as the cached stat info in NodeRef would fail to match the stat info to check that the path still exists, as `lstat` returned the stat info of the resolved symlink. Replacing `lstat` with `stat` fixes the mismatching stat information cached in the NodeRef. * Fixes #17750 Change-Id: I7cc360dd4678d2c4cf1186e9f39490a6bfd946a2 Reviewed-on: https://review.haiku-os.org/c/haiku/+/5325 Tested-by: Commit checker robot Reviewed-by: waddlesplash Reviewed-by: Alex von Gluck IV --- src/build/libroot/fs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/build/libroot/fs.cpp b/src/build/libroot/fs.cpp index 3eed597060..0e1cc40aa4 100644 --- a/src/build/libroot/fs.cpp +++ b/src/build/libroot/fs.cpp @@ -369,7 +369,7 @@ get_path(const NodeRef *ref, const char *name, string &path) // stat the path to check, if it is still valid struct stat st; - if (lstat(path.c_str(), &st) < 0) { + if (stat(path.c_str(), &st) < 0) { sDirPathMap.erase(it); return errno; }