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 <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
This commit is contained in:
Jessica Hamilton 2022-05-20 16:08:35 +00:00 committed by Alex von Gluck IV
parent 87db9cb2a6
commit f5dd7d3c7b

View File

@ -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;
}