X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/305e4faec28e5e0eb990009f720aef91c1ecba92..5fcc791a74a6f6933b3fb03f36e9ea3553152cf7:/src/src/exim.c diff --git a/src/src/exim.c b/src/src/exim.c index 63ac620e7..695618fd7 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -309,6 +309,7 @@ milliwait(struct itimerval *itval) { sigset_t sigmask; sigset_t old_sigmask; +int save_errno = errno; if (itval->it_value.tv_usec < 50 && itval->it_value.tv_sec == 0) return; @@ -322,6 +323,8 @@ if (setitimer(ITIMER_REAL, itval, NULL) < 0) /* Start timer */ (void)sigdelset(&sigmask, SIGALRM); /* Remove SIGALRM */ (void)sigsuspend(&sigmask); /* Until SIGALRM */ (void)sigprocmask(SIG_SETMASK, &old_sigmask, NULL); /* Restore mask */ +errno = save_errno; +sigalrm_seen = FALSE; } @@ -727,9 +730,13 @@ exit(rc); void -exim_underbar_exit(int rc) +exim_underbar_exit(int rc, const uschar * process) { store_exit(); +DEBUG(D_any) + debug_printf(">>>>>>>>>>>>>>>> Exim pid=%d %s%s%sterminating with rc=%d " + ">>>>>>>>>>>>>>>>\n", (int)getpid(), + process ? "(" : "", process, process ? ") " : "", rc); _exit(rc); } @@ -826,7 +833,7 @@ int start, end, domain; uschar *parse_error = NULL; uschar *address = parse_extract_address(s, &parse_error, &start, &end, &domain, FALSE); -if (address == NULL) +if (!address) { fprintf(stdout, "syntax error: %s\n", parse_error); *exit_value = 2; @@ -2621,8 +2628,10 @@ for (i = 1; i < argc; i++) #ifdef SUPPORT_I18N allow_utf8_domains = TRUE; #endif - sender_address = parse_extract_address(argrest, &errmess, - &dummy_start, &dummy_end, &sender_address_domain, TRUE); + if (!(sender_address = parse_extract_address(argrest, &errmess, + &dummy_start, &dummy_end, &sender_address_domain, TRUE))) + exim_fail("exim: bad -f address \"%s\": %s\n", argrest, errmess); + sender_address = string_copy_taint(sender_address, TRUE); #ifdef SUPPORT_I18N message_smtputf8 = string_is_utf8(sender_address); @@ -2630,8 +2639,6 @@ for (i = 1; i < argc; i++) #endif allow_domain_literals = FALSE; strip_trailing_dot = FALSE; - if (!sender_address) - exim_fail("exim: bad -f address \"%s\": %s\n", argrest, errmess); } f.sender_address_forced = TRUE; } @@ -4607,7 +4614,7 @@ if (msg_action_arg > 0 && msg_action != MSG_LOAD) else if ((pid = fork()) == 0) { (void)deliver_message(argv[i], forced_delivery, deliver_give_up); - exim_underbar_exit(EXIT_SUCCESS); + exim_underbar_exit(EXIT_SUCCESS, US"cmdline-delivery"); } else if (pid < 0) { @@ -4627,10 +4634,10 @@ turn into a queue runner, with an optional starting message id. */ if (queue_interval == 0 && !f.daemon_listen) { DEBUG(D_queue_run) debug_printf("Single queue run%s%s%s%s\n", - (start_queue_run_id == NULL)? US"" : US" starting at ", - (start_queue_run_id == NULL)? US"" : start_queue_run_id, - (stop_queue_run_id == NULL)? US"" : US" stopping at ", - (stop_queue_run_id == NULL)? US"" : stop_queue_run_id); + start_queue_run_id ? US" starting at " : US"", + start_queue_run_id ? start_queue_run_id: US"", + stop_queue_run_id ? US" stopping at " : US"", + stop_queue_run_id ? stop_queue_run_id : US""); if (*queue_name) set_process_info("running the '%s' queue (single queue run)", queue_name); else @@ -5467,8 +5474,7 @@ while (more) errmess = US"unqualified recipient address not allowed"; } - if (recipient == NULL) - { + if (!recipient) if (error_handling == ERRORS_STDERR) { fprintf(stderr, "exim: bad recipient address \"%s\": %s\n", @@ -5485,7 +5491,6 @@ while (more) moan_to_sender(ERRMESS_BADARGADDRESS, &eblock, NULL, stdin, TRUE)? errors_sender_rc : EXIT_FAILURE; } - } receive_add_recipient(string_copy_taint(recipient, TRUE), -1); s = ss; @@ -5710,7 +5715,7 @@ while (more) rc = deliver_message(message_id, FALSE, FALSE); search_tidyup(); exim_underbar_exit(!mua_wrapper || rc == DELIVER_MUA_SUCCEEDED - ? EXIT_SUCCESS : EXIT_FAILURE); + ? EXIT_SUCCESS : EXIT_FAILURE, US"cmdline-delivery"); } if (pid < 0)