From: Andrew Krieger Date: Fri, 14 Apr 2017 02:23:50 +0000 (-0700) Subject: Explicitly use CreateFileA in readlink X-Git-Tag: v2017.04.17.00~17 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=91b69f13e93474318fc63d9f9905d05b7552ce07;p=folly.git 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 --- 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; }