Only chdir("/") when detaching from TTY and backgrounding process
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
parent
4f5124cb79
commit
e9a546c683
@ -405,9 +405,6 @@ int main(int argc, char *argv[])
|
|||||||
int num_fds, maxfds;
|
int num_fds, maxfds;
|
||||||
int i, ch;
|
int i, ch;
|
||||||
|
|
||||||
#ifndef TESTING
|
|
||||||
chdir("/");
|
|
||||||
#endif
|
|
||||||
for (i = 1; i < MAXFUNIX; i++) {
|
for (i = 1; i < MAXFUNIX; i++) {
|
||||||
funixn[i] = "";
|
funixn[i] = "";
|
||||||
funix[i] = -1;
|
funix[i] = -1;
|
||||||
@ -506,6 +503,8 @@ int main(int argc, char *argv[])
|
|||||||
logit("Checking pidfile.\n");
|
logit("Checking pidfile.\n");
|
||||||
if (!check_pid(PidFile)) {
|
if (!check_pid(PidFile)) {
|
||||||
signal(SIGTERM, doexit);
|
signal(SIGTERM, doexit);
|
||||||
|
chdir("/");
|
||||||
|
|
||||||
if (fork()) {
|
if (fork()) {
|
||||||
/*
|
/*
|
||||||
* Parent process
|
* Parent process
|
||||||
|
Loading…
Reference in New Issue
Block a user