On Thu, 7 May 1998, I wrote:
> Would you like me to send you some sample code to try out, or can you
> hack this up by yourself? Please let me know if it solves the problem.
It turned out to be easy enough to reproduce, and easy enough to fix.
The patch is below. It's great when the bug reporter does all the
diagnostic work!
--
Philip Hazel University Computing Service,
ph10@??? New Museums Site, Cambridge CB2 3QG,
P.Hazel@??? England. Phone: +44 1223 334714
*** exim-1.92/src/daemon.c Wed Apr 29 09:55:08 1998
--- daemon.c Thu May 7 09:23:33 1998
***************
*** 179,198 ****
/* This function is called when an SMTP connection has been accepted.
If there are too many, give an error message and close down. Otherwise
! spin off a sub-process to handle the call. The listening socket is
! required so that it can be closed in the sub-process.
Arguments:
! listen_socket socket which is listening for incoming calls
! accept_socket socket of the current accepted call
! accepted socket information about the current call
Returns: nothing
*/
static void
! handle_smtp_call(int listen_socket, int accept_socket,
! struct sockaddr *accepted)
{
pid_t pid;
int dup_accept_socket = dup(accept_socket);
--- 181,201 ----
/* This function is called when an SMTP connection has been accepted.
If there are too many, give an error message and close down. Otherwise
! spin off a sub-process to handle the call. The list of listening sockets
! is required so that they can be closed in the sub-process.
Arguments:
! listen_sockets sockets which are listening for incoming calls
! listen_socket_count count of listening sockets
! accept_socket socket of the current accepted call
! accepted socket information about the current call
Returns: nothing
*/
static void
! handle_smtp_call(int *listen_sockets, int listen_socket_count,
! int accept_socket, struct sockaddr *accepted)
{
pid_t pid;
int dup_accept_socket = dup(accept_socket);
***************
*** 265,274 ****
if (pid == 0)
{
BOOL local_queue_only = queue_only;
BOOL smtp_first = TRUE;
! /* Close the listening socket, and set the SIGCHLD handler to SIG_IGN.
This is not the same as SIG_DFL, despite the fact that documentation often
lists the default as "ignore". At least on some systems, setting SIG_IGN
causes child processes that complete simply to go away without ever becoming
--- 268,278 ----
if (pid == 0)
{
+ int i;
BOOL local_queue_only = queue_only;
BOOL smtp_first = TRUE;
! /* Close the listening sockets, and set the SIGCHLD handler to SIG_IGN.
This is not the same as SIG_DFL, despite the fact that documentation often
lists the default as "ignore". At least on some systems, setting SIG_IGN
causes child processes that complete simply to go away without ever becoming
***************
*** 275,281 ****
defunct. You can't therefore wait for them - but in this process we don't
want to wait for them as they are doing independent deliveries. */
! close(listen_socket);
signal(SIGCHLD, SIG_IGN);
/* Attempt to get an id from the sending machine via the RFC 1413
--- 279,285 ----
defunct. You can't therefore wait for them - but in this process we don't
want to wait for them as they are doing independent deliveries. */
! for (i = 0; i < listen_socket_count; i++) close(listen_sockets[i]);
signal(SIGCHLD, SIG_IGN);
/* Attempt to get an id from the sending machine via the RFC 1413
***************
*** 1134,1140 ****
/* If select/accept succeeded, deal with the connection. */
if (accept_socket >= 0)
! handle_smtp_call(listen_sockets[sk], accept_socket,
(struct sockaddr *)&accepted);
}
}
--- 1138,1144 ----
/* If select/accept succeeded, deal with the connection. */
if (accept_socket >= 0)
! handle_smtp_call(listen_sockets, listen_socket_count, accept_socket,
(struct sockaddr *)&accepted);
}
}
--
*** Exim information can be found at
http://www.exim.org/ ***