X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Fdaemon.c;h=34786837a67e1d0117e176e5a2bca4aa65bedd62;hb=8e7e13572850c65857fd9d2da8b341e1ca3e98b7;hp=3ace7e9dbb5fc3efe8f5d76ce47b31db36069ee4;hpb=4670e9d3b06f6f14c5d868f786b75e2d6b921c8d;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/daemon.c b/src/src/daemon.c index 3ace7e9db..34786837a 100644 --- a/src/src/daemon.c +++ b/src/src/daemon.c @@ -290,7 +290,7 @@ if ((max_for_this_host > 0) && int other_host_count = 0; /* keep a count of non matches to optimise */ for (i = 0; i < smtp_accept_max; ++i) - if (smtp_slots[i].host_address != NULL) + if (smtp_slots[i].host_address) { if (Ustrcmp(sender_host_address, smtp_slots[i].host_address) == 0) host_accept_count++; @@ -520,12 +520,13 @@ if (pid == 0) { if (smtp_out) { - int i; + int i, fd = fileno(smtp_in); uschar buf[128]; mac_smtp_fflush(); /* drain socket, for clean TCP FINs */ - for(i = 16; read(fileno(smtp_in), buf, sizeof(buf)) > 0 && i > 0; ) i--; + if (fcntl(fd, F_SETFL, O_NONBLOCK) == 0) + for(i = 16; read(fd, buf, sizeof(buf)) > 0 && i > 0; ) i--; } search_tidyup(); smtp_log_no_mail(); /* Log no mail if configured */ @@ -841,13 +842,12 @@ while ((pid = waitpid(-1, &status, WNOHANG)) > 0) /* If it's a listening daemon for which we are keeping track of individual subprocesses, deal with an accepting process that has terminated. */ - if (smtp_slots != NULL) + if (smtp_slots) { for (i = 0; i < smtp_accept_max; i++) - { if (smtp_slots[i].pid == pid) { - if (smtp_slots[i].host_address != NULL) + if (smtp_slots[i].host_address) store_free(smtp_slots[i].host_address); smtp_slots[i] = empty_smtp_slot; if (--smtp_accept_count < 0) smtp_accept_count = 0; @@ -855,7 +855,6 @@ while ((pid = waitpid(-1, &status, WNOHANG)) > 0) smtp_accept_count, (smtp_accept_count == 1)? "" : "es"); break; } - } if (i < smtp_accept_max) continue; /* Found an accepting process */ } @@ -1460,7 +1459,7 @@ if (daemon_listen && !inetd_wait_mode) #ifdef TCP_FASTOPEN if (setsockopt(listen_sockets[sk], IPPROTO_TCP, TCP_FASTOPEN, &smtp_connect_backlog, sizeof(smtp_connect_backlog))) - DEBUG(D_any) debug_printf("setsockopt FASTOPEN: %s", strerror(errno)); + DEBUG(D_any) debug_printf("setsockopt FASTOPEN: %s\n", strerror(errno)); #endif /* Start listening on the bound socket, establishing the maximum backlog of