mdmon: don't fork if DEBUG

This commit is contained in:
Dan Williams 2008-07-24 17:26:24 -07:00
parent f54e6321a2
commit 16ddab0daf
1 changed files with 32 additions and 16 deletions

16
mdmon.c
View File

@ -169,6 +169,19 @@ static void wake_me(int sig)
}
/* if we are debugging and starting mdmon by hand then don't fork */
static int do_fork(void)
{
#ifdef DEBUG
if (env_no_mdmon())
return 0;
#endif
return 1;
}
int main(int argc, char *argv[])
{
int mdfd;
@ -196,6 +209,7 @@ int main(int argc, char *argv[])
}
/* Fork, and have the child tell us when they are ready */
if (do_fork()) {
pipe(pfd);
switch(fork()) {
case -1:
@ -213,6 +227,8 @@ int main(int argc, char *argv[])
}
exit(status);
}
} else
pfd[0] = pfd[1] = -1;
/* hopefully it is a container - we'll check later */
container = malloc(sizeof(*container));