diff options
author | Ilnur Khuziev <ilnur.khuziev@yandex.ru> | 2022-02-10 16:46:13 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:13 +0300 |
commit | 736dcd8ca259457a136f2f9f9168c44643914323 (patch) | |
tree | ddd46a036d68bfa83aa11b892f31243ea6b068a1 /util/folder/lstat_win.c | |
parent | 9bf2fa2b060c9881d3135c2208c624a1dd546ecc (diff) | |
download | ydb-736dcd8ca259457a136f2f9f9168c44643914323.tar.gz |
Restoring authorship annotation for Ilnur Khuziev <ilnur.khuziev@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'util/folder/lstat_win.c')
-rw-r--r-- | util/folder/lstat_win.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/util/folder/lstat_win.c b/util/folder/lstat_win.c index cf94cec01a..43951ecd32 100644 --- a/util/folder/lstat_win.c +++ b/util/folder/lstat_win.c @@ -5,22 +5,22 @@ #include "lstat_win.h" int lstat(const char* fileName, stat_struct* fileStat) { - int len = strlen(fileName); - int convRes = MultiByteToWideChar(CP_UTF8, 0, fileName, len, 0, 0); - if (convRes == 0) { - return -1; - } - WCHAR* buf = malloc(sizeof(WCHAR) * (convRes + 1)); - MultiByteToWideChar(CP_UTF8, 0, fileName, len, buf, convRes); - buf[convRes] = 0; - + int len = strlen(fileName); + int convRes = MultiByteToWideChar(CP_UTF8, 0, fileName, len, 0, 0); + if (convRes == 0) { + return -1; + } + WCHAR* buf = malloc(sizeof(WCHAR) * (convRes + 1)); + MultiByteToWideChar(CP_UTF8, 0, fileName, len, buf, convRes); + buf[convRes] = 0; + HANDLE findHandle; - WIN32_FIND_DATAW findBuf; + WIN32_FIND_DATAW findBuf; int result; - result = _wstat64(buf, fileStat); + result = _wstat64(buf, fileStat); if (result == 0) { SetLastError(0); - findHandle = FindFirstFileW(buf, &findBuf); + findHandle = FindFirstFileW(buf, &findBuf); if (findBuf.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT && (findBuf.dwReserved0 == IO_REPARSE_TAG_MOUNT_POINT || findBuf.dwReserved0 == IO_REPARSE_TAG_SYMLINK)) { @@ -28,7 +28,7 @@ int lstat(const char* fileName, stat_struct* fileStat) { } FindClose(findHandle); } - free(buf); + free(buf); return result; } |