aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/sysstat.cpp
diff options
context:
space:
mode:
authorleo <leo@yandex-team.ru>2022-02-10 16:46:40 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:40 +0300
commit980edcd3304699edf9d4e4d6a656e585028e2a72 (patch)
tree139f47f3911484ae9af0eb347b1a88bd6c4bb35f /util/system/sysstat.cpp
parentb036a557f285146e5e35d4213e29a094ab907bcf (diff)
downloadydb-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.cpp86
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