From: Timo Sirainen Date: Wed, 23 Jun 2004 17:48:35 +0000 (+0300) Subject: DEBUG: If GDB environment is set, don't do fd leak checks. X-Git-Tag: 1.1.alpha1~3871 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b565c76999227da8db3670ec2f4b0c39690d8c40;p=thirdparty%2Fdovecot%2Fcore.git DEBUG: If GDB environment is set, don't do fd leak checks. --HG-- branch : HEAD --- diff --git a/src/imap/main.c b/src/imap/main.c index ede12e2578..7aff236e95 100644 --- a/src/imap/main.c +++ b/src/imap/main.c @@ -166,7 +166,7 @@ static void main_deinit(void) int main(int argc __attr_unused__, char *argv[], char *envp[]) { #ifdef DEBUG - if (getenv("LOGGED_IN") != NULL) + if (getenv("LOGGED_IN") != NULL && getenv("GDB") == NULL) fd_debug_verify_leaks(3, 1024); #endif /* NOTE: we start rooted, so keep the code minimal until diff --git a/src/login-common/main.c b/src/login-common/main.c index 7ef35b0a78..7df9ce1e01 100644 --- a/src/login-common/main.c +++ b/src/login-common/main.c @@ -229,7 +229,7 @@ int main(int argc __attr_unused__, char *argv[], char *envp[]) is_inetd = getenv("DOVECOT_MASTER") == NULL; #ifdef DEBUG - if (!is_inetd) + if (!is_inetd && getenv("GDB") == NULL) fd_debug_verify_leaks(4, 1024); #endif /* NOTE: we start rooted, so keep the code minimal until diff --git a/src/master/main.c b/src/master/main.c index d5060d8ed0..04a17f3003 100644 --- a/src/master/main.c +++ b/src/master/main.c @@ -37,6 +37,9 @@ struct ioloop *ioloop; struct hash_table *pids; int null_fd, inetd_login_fd; uid_t master_uid; +#ifdef DEBUG +static int gdb; +#endif int validate_str(const char *str, size_t max_len) { @@ -57,6 +60,10 @@ void child_process_init_env(void) /* we'll log through master process */ env_put("LOG_TO_MASTER=1"); + +#ifdef DEBUG + if (gdb) env_put("GDB=1"); +#endif } static void sig_quit(int signo __attr_unused__) @@ -469,6 +476,9 @@ int main(int argc, char *argv[]) exit(FATAL_DEFAULT); open_fds(); +#ifdef DEBUG + gdb = getenv("GDB") != NULL; +#endif /* we don't need any environment */ env_clean(); diff --git a/src/pop3/main.c b/src/pop3/main.c index e66724944f..0e2fb8f06a 100644 --- a/src/pop3/main.c +++ b/src/pop3/main.c @@ -138,7 +138,7 @@ static void main_deinit(void) int main(int argc __attr_unused__, char *argv[], char *envp[]) { #ifdef DEBUG - if (getenv("LOGGED_IN") != NULL) + if (getenv("LOGGED_IN") != NULL && getenv("GDB") == NULL) fd_debug_verify_leaks(3, 1024); #endif /* NOTE: we start rooted, so keep the code minimal until