From 74c3262f03c4ea1c842402d265f93a83df5e3864 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Thu, 14 Jul 2016 17:24:00 -0700 Subject: [PATCH] Fix failing New-Item tests PowerShell expects the behavior of NativeItemExists to not follow symbolic links. --- src/libpsl-native/src/isfile.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libpsl-native/src/isfile.cpp b/src/libpsl-native/src/isfile.cpp index b2cead6cd..89c415f47 100644 --- a/src/libpsl-native/src/isfile.cpp +++ b/src/libpsl-native/src/isfile.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include "isfile.h" @@ -36,5 +37,6 @@ bool IsFile(const char* path) return false; } - return access(path, F_OK) != -1; + // Resolve relative paths to cwd of process, and do not follow symlinks + return faccessat(AT_FDCWD, path, F_OK, AT_SYMLINK_NOFOLLOW) != -1; }