Fix failing New-Item tests

PowerShell expects the behavior of NativeItemExists to not follow
symbolic links.
This commit is contained in:
Andrew Schwartzmeyer
2016-07-14 17:34:12 -07:00
parent 35e24ce6d4
commit 74c3262f03
+3 -1
View File
@@ -7,6 +7,7 @@
#include <sys/stat.h>
#include <pwd.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#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;
}