summaryrefslogtreecommitdiff
path: root/src/daemon.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2015-12-27 18:39:47 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2015-12-27 18:40:08 +0900
commitb1132d6b10cd3791b9529d7031d723fd0e2d8215 (patch)
tree9ce465b42bf09372118335c7c619bb2b41869eaf /src/daemon.cc
parent4abad2f64c9ff80144a61c5a9c2bea144852b883 (diff)
make clang-format using clang-format-3.6
Diffstat (limited to 'src/daemon.cc')
-rw-r--r--src/daemon.cc24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/daemon.cc b/src/daemon.cc
index 154385c1..60be5bb3 100644
--- a/src/daemon.cc
+++ b/src/daemon.cc
@@ -45,33 +45,35 @@ int daemon(int nochdir, int noclose)
#ifdef HAVE_WORKING_FORK
pid_t pid;
pid = fork();
- if(pid == -1) {
+ if (pid == -1) {
return -1;
- } else if(pid > 0) {
+ }
+ else if (pid > 0) {
_exit(EXIT_SUCCESS);
}
- if(setsid() == -1) {
+ if (setsid() == -1) {
return -1;
}
pid = fork();
- if(pid == -1) {
+ if (pid == -1) {
return -1;
- } else if(pid > 0) {
+ }
+ else if (pid > 0) {
_exit(EXIT_SUCCESS);
}
- if(nochdir == 0) {
- if(chdir("/") == -1) {
+ if (nochdir == 0) {
+ if (chdir("/") == -1) {
return -1;
}
}
- if(noclose == 0) {
- if(freopen("/dev/null", "r", stdin) == nullptr) {
+ if (noclose == 0) {
+ if (freopen("/dev/null", "r", stdin) == nullptr) {
return -1;
}
- if(freopen("/dev/null", "w", stdout) == nullptr) {
+ if (freopen("/dev/null", "w", stdout) == nullptr) {
return -1;
}
- if(freopen("/dev/null", "w", stderr) == nullptr) {
+ if (freopen("/dev/null", "w", stderr) == nullptr) {
return -1;
}
}