if (debug_fd > 0) force_fd(debug_fd, 2);
if (f.running_in_test_harness && !queue_only)
{
- if (sender_authentication != NULL)
+ if (sender_authentication)
child_exec_exim(CEE_EXEC_EXIT, FALSE, NULL, FALSE, 9,
US "-odi", US"-t", US"-oem", US"-oi", US"-f", sender, US"-oMas",
sender_authentication, message_id_option);
}
else /* Not test harness */
{
- if (sender_authentication != NULL)
+ if (sender_authentication)
child_exec_exim(CEE_EXEC_EXIT, FALSE, NULL, FALSE, 8,
US"-t", US"-oem", US"-oi", US"-f", sender, US"-oMas",
sender_authentication, message_id_option);
otherwise. Save the old state for resetting on the wait. */
oldsignal = signal(SIGCHLD, SIG_DFL);
-pid = exim_fork(US"queryprogram"); /* queryprogram tpt is sole caller */
+pid = exim_fork(US"child-open");
/* Handle the child process. First, set the required environment. We must do
this before messing with the pipes, in order to be able to write debugging
signal(SIGUSR1, SIG_IGN);
signal(SIGPIPE, SIG_DFL);
- if (newgid != NULL && setgid(*newgid) < 0)
+ if (newgid && setgid(*newgid) < 0)
{
DEBUG(D_any) debug_printf("failed to set gid=%ld in subprocess: %s\n",
(long int)(*newgid), strerror(errno));
goto CHILD_FAILED;
}
- if (newuid != NULL && setuid(*newuid) < 0)
+ if (newuid && setuid(*newuid) < 0)
{
DEBUG(D_any) debug_printf("failed to set uid=%ld in subprocess: %s\n",
(long int)(*newuid), strerror(errno));
(void)umask(newumask);
- if (wd != NULL && Uchdir(wd) < 0)
+ if (wd && Uchdir(wd) < 0)
{
DEBUG(D_any) debug_printf("failed to chdir to %s: %s\n", wd,
strerror(errno));
/* Now do the exec */
- if (envp == NULL) execv(CS argv[0], (char *const *)argv);
- else execve(CS argv[0], (char *const *)argv, (char *const *)envp);
+ if (envp) execve(CS argv[0], (char *const *)argv, (char *const *)envp);
+ else execv(CS argv[0], (char *const *)argv);
/* Failed to execv. Signal this failure using EX_EXECFAILED. We are
losing the actual errno we got back, because there is no way to return
have enough queue runners on the go. If we are not running as root, a
re-exec is required. */
- if (queue_interval > 0 &&
- (local_queue_run_max <= 0 || queue_run_count < local_queue_run_max))
+ if ( queue_interval > 0
+ && (local_queue_run_max <= 0 || queue_run_count < local_queue_run_max))
{
if ((pid = exim_fork(US"queue runner")) == 0)
{
void
millisleep(int msec)
{
-struct itimerval itval;
-itval.it_interval.tv_sec = 0;
-itval.it_interval.tv_usec = 0;
-itval.it_value.tv_sec = msec/1000;
-itval.it_value.tv_usec = (msec % 1000) * 1000;
+struct itimerval itval = {.it_interval = {.tv_sec = 0, .tv_usec = 0},
+ .it_value = {.tv_sec = msec/1000,
+ .tv_usec = (msec % 1000) * 1000}};
milliwait(&itval);
}
just bombing out, force the log to stderr and carry on if stderr is available.
*/
-if (euid != root_uid && euid != exim_uid && log_stderr != NULL)
+if (euid != root_uid && euid != exim_uid && log_stderr)
{
*fd = fileno(log_stderr);
return;
/* Otherwise this is a disaster. This call is deliberately ONLY to the panic
log. If possible, save a copy of the original line that was being logged. If we
are recursing (can't open the panic log either), the pointer will already be
-set. */
+set. Also, when we had to use a subprocess for the create we didn't retrieve
+errno from it, so get the error from the open attempt above (which is often
+meaningful enough, so leave it). */
if (!panic_save_buffer)
if ((panic_save_buffer = US malloc(LOG_BUFFER_SIZE)))
{
BOOL last_filter_was_NL = TRUE;
BOOL save_spool_file_wireformat = f.spool_file_wireformat;
-int rc, len, yield, fd_read, fd_write, save_errno;
+BOOL yield;
+int rc, len, fd_read, fd_write, save_errno;
int pfd[2] = {-1, -1};
pid_t filter_pid, write_pid;
smtp dots, or check string processing. */
if (pipe(pfd) != 0) goto TIDY_UP; /* errno set */
-if ((write_pid = exim_fork(US"transport filter")) == 0)
+if ((write_pid = exim_fork(US"transport filter writer")) == 0)
{
BOOL rc;
(void)close(fd_read);
!= sizeof(struct timeval)
)
rc = FALSE; /* compiler quietening */
- exim_underbar_exit(0, US"tpt-filter");
+ exim_underbar_exit(0, US"tpt-filter writer");
}
save_errno = errno;
ALARM_CLR(0);
if (sigalrm_seen)
{
+ DEBUG(D_transport) debug_printf("timed out reading from filter\n");
errno = ETIMEDOUT;
f.transport_filter_timed_out = TRUE;
goto TIDY_UP;
{
debug_printf("end of filtering transport writing: yield=%d\n", yield);
if (!yield)
- debug_printf("errno=%d more_errno=%d\n", errno, tctx->addr->more_errno);
+ debug_printf(" errno=%d more_errno=%d\n", errno, tctx->addr->more_errno);
}
return yield;
}
/* first thing remove current message id if it exists */
+ /*XXX but what if it has un-sent addrs? */
for (i = 0; i < msgq_count; ++i)
if (Ustrcmp(msgq[i].message_id, message_id) == 0)
smtp_local_identity(s_compare->current_sender_address, s_compare->tblock);
if (!(new_sender_address = deliver_get_sender_address(message_id)))
- return 0;
+ return FALSE;
message_local_identity =
smtp_local_identity(new_sender_address, s_compare->tblock);
}
/* If there is a filter command specified for this transport, we can now
-set it up. This cannot be done until the identify of the host is known. */
+set it up. This cannot be done until the identity of the host is known. */
if (tblock->filter_command)
{
process pppp running as transport filter: fd_write=dddd fd_read=dddd
cannot use sendfile for body: spoolfile not wireformat
writing data block fd=dddd size=sss timeout=0
->>>>>>>>>>>>>>>> Exim pid=pppp (tpt-filter) terminating with rc=0 >>>>>>>>>>>>>>>>
+>>>>>>>>>>>>>>>> Exim pid=pppp (tpt-filter writer) terminating with rc=0 >>>>>>>>>>>>>>>>
process pppp writing to transport filter
copying from the filter
waiting for filter process