-/* $Cambridge: exim/src/src/daemon.c,v 1.16 2006/09/05 14:14:32 ph10 Exp $ */
+/* $Cambridge: exim/src/src/daemon.c,v 1.18 2006/11/07 15:56:17 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
goto ERROR_RETURN;
}
-/* Get the data for the local interface address. */
+/* Get the data for the local interface address. Panic for most errors, but
+"connection reset by peer" just means the connection went away. */
if (getsockname(accept_socket, (struct sockaddr *)(&interface_sockaddr),
&ifsize) < 0)
{
- log_write(0, LOG_MAIN|LOG_PANIC, "getsockname() failed: %s",
- strerror(errno));
+ log_write(0, LOG_MAIN | ((errno == ECONNRESET)? 0 : LOG_PANIC),
+ "getsockname() failed: %s", strerror(errno));
smtp_printf("421 Local problem: getsockname() failed; please try again later\r\n");
goto ERROR_RETURN;
}
{
uschar opt[8];
uschar *p = opt;
+ uschar *extra[4];
+ int extracount = 1;
signal(SIGALRM, SIG_DFL);
*p++ = '-';
if (deliver_force_thaw) *p++ = 'f';
if (queue_run_local) *p++ = 'l';
*p = 0;
+ extra[0] = opt;
+
+ /* If -R or -S were on the original command line, ensure they get
+ passed on. */
+
+ if (deliver_selectstring != NULL)
+ {
+ extra[extracount++] = deliver_selectstring_regex? US"-Rr" : US"-R";
+ extra[extracount++] = deliver_selectstring;
+ }
+
+ if (deliver_selectstring_sender != NULL)
+ {
+ extra[extracount++] = deliver_selectstring_sender_regex?
+ US"-Sr" : US"-S";
+ extra[extracount++] = deliver_selectstring_sender;
+ }
+
+ /* Overlay this process with a new execution. */
+
+ (void)child_exec_exim(CEE_EXEC_PANIC, FALSE, NULL, TRUE, extracount,
+ extra[0], extra[1], extra[2], extra[3], extra[4]);
- (void)child_exec_exim(CEE_EXEC_PANIC, FALSE, NULL, TRUE, 1, opt);
/* Control never returns here. */
}