diff options
author | ermolovd <ermolovd@yandex-team.ru> | 2022-02-10 16:47:53 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:53 +0300 |
commit | b91bcef7c99a119b0846479ef71bfab4beec72ca (patch) | |
tree | be118d54d12a61bc4812ceb0a266a170a2fa3bc9 /util/system | |
parent | f421873774cf0b71743afbe5f6677861e66601ea (diff) | |
download | ydb-b91bcef7c99a119b0846479ef71bfab4beec72ca.tar.gz |
Restoring authorship annotation for <ermolovd@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/system')
-rw-r--r-- | util/system/defaults.h | 4 | ||||
-rw-r--r-- | util/system/env.cpp | 2 | ||||
-rw-r--r-- | util/system/file.cpp | 10 | ||||
-rw-r--r-- | util/system/file_ut.cpp | 54 |
4 files changed, 35 insertions, 35 deletions
diff --git a/util/system/defaults.h b/util/system/defaults.h index dcd7abea38..02e786b7c2 100644 --- a/util/system/defaults.h +++ b/util/system/defaults.h @@ -130,10 +130,10 @@ constexpr bool Y_IS_DEBUG_BUILD = true; #undef Y_ARRAY_BEGIN #define Y_ARRAY_BEGIN(arr) (arr) - + #undef Y_ARRAY_END #define Y_ARRAY_END(arr) ((arr) + Y_ARRAY_SIZE(arr)) - + /** * Concatenates two symbols, even if one of them is itself a macro. */ diff --git a/util/system/env.cpp b/util/system/env.cpp index ead9b566a5..fc44e64c2e 100644 --- a/util/system/env.cpp +++ b/util/system/env.cpp @@ -1,7 +1,7 @@ #include "env.h" #include <util/generic/string.h> -#include <util/generic/yexception.h> +#include <util/generic/yexception.h> #ifdef _win_ #include <util/generic/vector.h> diff --git a/util/system/file.cpp b/util/system/file.cpp index 4a261d020c..76b033cee2 100644 --- a/util/system/file.cpp +++ b/util/system/file.cpp @@ -425,8 +425,8 @@ bool TFileHandle::Flush() noexcept { */ return ok || GetLastError() == ERROR_INVALID_HANDLE; #elif defined(_unix_) - int ret = ::fsync(Fd_); - + int ret = ::fsync(Fd_); + /* * Ignore EROFS, EINVAL - fd is bound to a special file * (PIPE, FIFO, or socket) which does not support synchronization. @@ -449,10 +449,10 @@ bool TFileHandle::FlushData() noexcept { return false; } - int ret = ::fdatasync(Fd_); - + int ret = ::fdatasync(Fd_); + // Same loginc in error handling as for fsync above. - return ret == 0 || errno == EROFS || errno == EINVAL; + return ret == 0 || errno == EROFS || errno == EINVAL; #else return Flush(); #endif diff --git a/util/system/file_ut.cpp b/util/system/file_ut.cpp index 941e6a50f3..07b2b7a96d 100644 --- a/util/system/file_ut.cpp +++ b/util/system/file_ut.cpp @@ -17,8 +17,8 @@ class TFileTest: public TTestBase { UNIT_TEST(TestLinkTo); UNIT_TEST(TestResize); UNIT_TEST(TestLocale); - UNIT_TEST(TestFlush); - UNIT_TEST(TestFlushSpecialFile); + UNIT_TEST(TestFlush); + UNIT_TEST(TestFlushSpecialFile); UNIT_TEST(TestRawRead); UNIT_TEST(TestRead); UNIT_TEST(TestRawPread); @@ -31,8 +31,8 @@ public: void TestOpenSync(); void TestRW(); void TestLocale(); - void TestFlush(); - void TestFlushSpecialFile(); + void TestFlush(); + void TestFlushSpecialFile(); void TestRawRead(); void TestRead(); void TestRawPread(); @@ -216,29 +216,29 @@ void TFileTest::TestLocale() { #endif } -void TFileTest::TestFlush() { - TTempFile tmp("tmp"); - - { - TFile f(tmp.Name(), OpenAlways | WrOnly); - f.Flush(); - f.FlushData(); - f.Close(); - - UNIT_ASSERT_EXCEPTION(f.Flush(), TFileError); - UNIT_ASSERT_EXCEPTION(f.FlushData(), TFileError); - } -} - -void TFileTest::TestFlushSpecialFile() { -#ifdef _unix_ - TFile devNull("/dev/null", WrOnly); - devNull.FlushData(); - devNull.Flush(); - devNull.Close(); -#endif -} - +void TFileTest::TestFlush() { + TTempFile tmp("tmp"); + + { + TFile f(tmp.Name(), OpenAlways | WrOnly); + f.Flush(); + f.FlushData(); + f.Close(); + + UNIT_ASSERT_EXCEPTION(f.Flush(), TFileError); + UNIT_ASSERT_EXCEPTION(f.FlushData(), TFileError); + } +} + +void TFileTest::TestFlushSpecialFile() { +#ifdef _unix_ + TFile devNull("/dev/null", WrOnly); + devNull.FlushData(); + devNull.Flush(); + devNull.Close(); +#endif +} + void TFileTest::TestRawRead() { TTempFile tmp("tmp"); |