diff options
author | dimko <dimko@yandex-team.ru> | 2022-02-10 16:50:07 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:07 +0300 |
commit | 5df1bbceafd25528f800dbe399738150b20384f3 (patch) | |
tree | 9dda05f18a06906442e3deff7861fccc32c2c260 /util/system | |
parent | a0e29f0026d32a60a618a620f30035c264346175 (diff) | |
download | ydb-5df1bbceafd25528f800dbe399738150b20384f3.tar.gz |
Restoring authorship annotation for <dimko@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/system')
-rw-r--r-- | util/system/daemon.cpp | 16 | ||||
-rw-r--r-- | util/system/daemon.h | 4 | ||||
-rw-r--r-- | util/system/error.cpp | 4 |
3 files changed, 12 insertions, 12 deletions
diff --git a/util/system/daemon.cpp b/util/system/daemon.cpp index 130e6c8f45..68c3dc9d55 100644 --- a/util/system/daemon.cpp +++ b/util/system/daemon.cpp @@ -13,13 +13,13 @@ #endif #include "daemon.h" - -#ifdef _unix_ + +#ifdef _unix_ using namespace NDaemonMaker; - + static bool Fork(EParent parent) { pid_t pid = fork(); - + if (pid > 0) { int status = 0; while (waitpid(pid, &status, 0) < 0 && errno == EINTR) { @@ -32,13 +32,13 @@ static bool Fork(EParent parent) { } else if (pid < 0) { ythrow TSystemError() << "Cannot fork"; } - + if (setsid() < 0) { ythrow TSystemError() << "Cannot setsid"; } - + pid = fork(); - + if (pid > 0) { _exit(0); } else if (pid < 0) { @@ -46,7 +46,7 @@ static bool Fork(EParent parent) { } return false; } - + #endif static void CloseFromToExcept(int from, int to, const int* except) { diff --git a/util/system/daemon.h b/util/system/daemon.h index b00793b9c9..8ed6fb67c7 100644 --- a/util/system/daemon.h +++ b/util/system/daemon.h @@ -1,11 +1,11 @@ #pragma once - + namespace NDaemonMaker { enum ECloseDescriptors { closeAll = 0, closeStdIoOnly }; - + enum EStdIoDescriptors { openNone = 0, openDevNull, diff --git a/util/system/error.cpp b/util/system/error.cpp index f778ec42cb..a9f782127f 100644 --- a/util/system/error.cpp +++ b/util/system/error.cpp @@ -84,9 +84,9 @@ void LastSystemErrorText(char* str, size_t size, int code) { FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, code, 0, str, DWORD(size), 0); Strip(str); #elif defined(_sun_) - strfcpy(str, strerror(code), size); + strfcpy(str, strerror(code), size); #elif defined(_freebsd_) || defined(_darwin_) || defined(_musl_) || defined(_bionic_) - strerror_r(code, str, size); + strerror_r(code, str, size); #elif defined(_linux_) | defined(_cygwin_) char* msg = strerror_r(code, str, size); strncpy(str, msg, size); |