Mercurial > dovecot > original-hg > dovecot-1.2
diff src/master/login-process.c @ 727:8dd8ebe6bcac HEAD
We use close-on-exec flag now to make sure that master process closes the
fds when executing other processes.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 01 Dec 2002 17:39:20 +0200 |
parents | 0438621d25ff |
children | db6fb0aa16d1 |
line wrap: on
line diff
--- a/src/master/login-process.c Sun Dec 01 17:37:19 2002 +0200 +++ b/src/master/login-process.c Sun Dec 01 17:39:20 2002 +0200 @@ -5,6 +5,7 @@ #include "network.h" #include "obuffer.h" #include "fdpass.h" +#include "fd-close-on-exec.h" #include "env-util.h" #include "restrict-access.h" #include "restrict-process-size.h" @@ -266,6 +267,7 @@ if (pid != 0) { /* master */ + fd_close_on_exec(fd[0], TRUE); login_process_new(pid, fd[0]); (void)close(fd[1]); return pid; @@ -274,14 +276,17 @@ /* move communication handle */ if (dup2(fd[1], LOGIN_MASTER_SOCKET_FD) < 0) i_fatal("login: dup2() failed: %m"); + fd_close_on_exec(LOGIN_MASTER_SOCKET_FD, FALSE); /* move the listen handle */ if (dup2(imap_fd, LOGIN_IMAP_LISTEN_FD) < 0) i_fatal("login: dup2() failed: %m"); + fd_close_on_exec(LOGIN_IMAP_LISTEN_FD, FALSE); /* move the SSL listen handle */ if (dup2(imaps_fd, LOGIN_IMAPS_LISTEN_FD) < 0) i_fatal("login: dup2() failed: %m"); + fd_close_on_exec(LOGIN_IMAPS_LISTEN_FD, FALSE); /* imap_fd and imaps_fd are closed by clean_child_process() */ @@ -340,19 +345,6 @@ wanted_processes_count = 0; } -static void login_hash_cleanup(void *key __attr_unused__, void *value, - void *context __attr_unused__) -{ - LoginProcess *p = value; - - (void)close(p->fd); -} - -void login_processes_cleanup(void) -{ - hash_foreach(processes, login_hash_cleanup, NULL); -} - static void login_hash_destroy(void *key __attr_unused__, void *value, void *context __attr_unused__) {