From 91b69f13e93474318fc63d9f9905d05b7552ce07 Mon Sep 17 00:00:00 2001 From: Andrew Krieger Date: Thu, 13 Apr 2017 19:23:50 -0700 Subject: [PATCH] Explicitly use CreateFileA in readlink Summary: In Unicode enabled projects, this errors because CreateFile aliases CreateFileW, which takes wchar_t* not char*. Reviewed By: Orvid, yfeldblum Differential Revision: D4878424 fbshipit-source-id: b44b369c0533e74163f68d95c2bf353584033731 --- folly/portability/Unistd.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/folly/portability/Unistd.cpp b/folly/portability/Unistd.cpp index 4d387b02..a587ba6a 100755 --- a/folly/portability/Unistd.cpp +++ b/folly/portability/Unistd.cpp @@ -205,13 +205,14 @@ ssize_t readlink(const char* path, char* buf, size_t buflen) { return -1; } - HANDLE h = CreateFile(path, - GENERIC_READ, - FILE_SHARE_READ, - nullptr, - OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS, - nullptr); + HANDLE h = CreateFileA( + path, + GENERIC_READ, + FILE_SHARE_READ, + nullptr, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, + nullptr); if (h == INVALID_HANDLE_VALUE) { return -1; } -- 2.34.1