aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/daemon.cpp
diff options
context:
space:
mode:
authordvshkurko <dvshkurko@yandex-team.ru>2022-02-10 16:45:52 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:52 +0300
commitc768a99151e47c3a4bb7b92c514d256abd301c4d (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/system/daemon.cpp
parent321ee9bce31ec6e238be26dbcbe539cffa2c3309 (diff)
downloadydb-c768a99151e47c3a4bb7b92c514d256abd301c4d.tar.gz
Restoring authorship annotation for <dvshkurko@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/system/daemon.cpp')
-rw-r--r--util/system/daemon.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/util/system/daemon.cpp b/util/system/daemon.cpp
index 5020720206..130e6c8f45 100644
--- a/util/system/daemon.cpp
+++ b/util/system/daemon.cpp
@@ -17,18 +17,18 @@
#ifdef _unix_
using namespace NDaemonMaker;
-static bool Fork(EParent parent) {
+static bool Fork(EParent parent) {
pid_t pid = fork();
if (pid > 0) {
- int status = 0;
- while (waitpid(pid, &status, 0) < 0 && errno == EINTR) {
- }
- if (parent == callExitFromParent) {
+ int status = 0;
+ while (waitpid(pid, &status, 0) < 0 && errno == EINTR) {
+ }
+ if (parent == callExitFromParent) {
_exit(0);
- } else {
- return true;
- }
+ } else {
+ return true;
+ }
} else if (pid < 0) {
ythrow TSystemError() << "Cannot fork";
}
@@ -44,7 +44,7 @@ static bool Fork(EParent parent) {
} else if (pid < 0) {
ythrow TSystemError() << "Cannot second fork";
}
- return false;
+ return false;
}
#endif
@@ -75,15 +75,15 @@ static void CloseFromToExcept(int from, int to, const int* except) {
#endif /* _unix_ */
}
-bool NDaemonMaker::MakeMeDaemon(ECloseDescriptors cd, EStdIoDescriptors iod, EChDir chd, EParent parent) {
+bool NDaemonMaker::MakeMeDaemon(ECloseDescriptors cd, EStdIoDescriptors iod, EChDir chd, EParent parent) {
(void)cd;
(void)iod;
(void)chd;
#ifdef _unix_
- if (Fork(parent)) {
- return true;
- }
+ if (Fork(parent)) {
+ return true;
+ }
if (chd == chdirRoot) {
if (chdir("/")) {
@@ -156,9 +156,9 @@ bool NDaemonMaker::MakeMeDaemon(ECloseDescriptors cd, EStdIoDescriptors iod, ECh
default:
break;
}
- return false;
-#else
- return true;
+ return false;
+#else
+ return true;
#endif
}