diff options
author | leo <leo@yandex-team.ru> | 2022-02-10 16:46:40 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:40 +0300 |
commit | 980edcd3304699edf9d4e4d6a656e585028e2a72 (patch) | |
tree | 139f47f3911484ae9af0eb347b1a88bd6c4bb35f /util/system/sysstat.cpp | |
parent | b036a557f285146e5e35d4213e29a094ab907bcf (diff) | |
download | ydb-980edcd3304699edf9d4e4d6a656e585028e2a72.tar.gz |
Restoring authorship annotation for <leo@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/system/sysstat.cpp')
-rw-r--r-- | util/system/sysstat.cpp | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/util/system/sysstat.cpp b/util/system/sysstat.cpp index db3338b02e..2cc5aa7793 100644 --- a/util/system/sysstat.cpp +++ b/util/system/sysstat.cpp @@ -1,47 +1,47 @@ -#include "sysstat.h" - -#ifdef _win_ - +#include "sysstat.h" + +#ifdef _win_ + #include "winint.h" #include <errno.h> - -int Chmod(const char* fname, int mode) { - if (!fname) { - errno = EINVAL; - return -1; - } - ui32 fAttr = ::GetFileAttributesA(fname); + +int Chmod(const char* fname, int mode) { + if (!fname) { + errno = EINVAL; + return -1; + } + ui32 fAttr = ::GetFileAttributesA(fname); if (fAttr == 0xffffffff) - return -1; - if (mode & _S_IWRITE) { - fAttr &= ~FILE_ATTRIBUTE_READONLY; - } else { - fAttr |= FILE_ATTRIBUTE_READONLY; - } - if (!::SetFileAttributesA(fname, fAttr)) { - return -1; - } - return 0; -} - -int Mkdir(const char* path, int /*mode*/) { - errno = 0; - if (!path) { - errno = EINVAL; - return -1; - } + return -1; + if (mode & _S_IWRITE) { + fAttr &= ~FILE_ATTRIBUTE_READONLY; + } else { + fAttr |= FILE_ATTRIBUTE_READONLY; + } + if (!::SetFileAttributesA(fname, fAttr)) { + return -1; + } + return 0; +} + +int Mkdir(const char* path, int /*mode*/) { + errno = 0; + if (!path) { + errno = EINVAL; + return -1; + } if (!CreateDirectoryA(path, (LPSECURITY_ATTRIBUTES) nullptr)) { - ui32 errCode = GetLastError(); - if (errCode == ERROR_ALREADY_EXISTS) { - errno = EEXIST; - } else if (errCode == ERROR_PATH_NOT_FOUND) { - errno = ENOENT; - } else { - errno = EINVAL; - } - return -1; - } - return 0; -} - -#endif + ui32 errCode = GetLastError(); + if (errCode == ERROR_ALREADY_EXISTS) { + errno = EEXIST; + } else if (errCode == ERROR_PATH_NOT_FOUND) { + errno = ENOENT; + } else { + errno = EINVAL; + } + return -1; + } + return 0; +} + +#endif |