[dovecot-cvs] dovecot/src/master main.c,1.80.2.15,1.80.2.16
tss at dovecot.org
tss at dovecot.org
Thu Jan 25 14:58:48 UTC 2007
Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv14308
Modified Files:
Tag: branch_1_0
main.c
Log Message:
If we see exit for unknown child process, log an error but don't crash. If
net_listen() fails with EINTR, try again unless it was interrupted by
INT/TERM signal.
Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/main.c,v
retrieving revision 1.80.2.15
retrieving revision 1.80.2.16
diff -u -d -r1.80.2.15 -r1.80.2.16
--- main.c 28 Dec 2006 19:59:35 -0000 1.80.2.15
+++ main.c 25 Jan 2007 14:58:46 -0000 1.80.2.16
@@ -203,7 +203,8 @@
while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
/* get the type and remove from hash */
process_type = PID_GET_PROCESS_TYPE(pid);
- PID_REMOVE_PROCESS_TYPE(pid);
+ if (process_type != PROCESS_TYPE_UNKNOWN)
+ PID_REMOVE_PROCESS_TYPE(pid);
abnormal_exit = TRUE;
@@ -211,9 +212,13 @@
process_type_name = process_names[process_type];
if (WIFEXITED(status)) {
status = WEXITSTATUS(status);
- if (status == 0)
+ if (status == 0) {
abnormal_exit = FALSE;
- else {
+ if (process_type == PROCESS_TYPE_UNKNOWN) {
+ i_error("unknown child %s exited "
+ "successfully", dec2str(pid));
+ }
+ } else {
msg = get_exit_status_message(status);
msg = msg == NULL ? "" :
t_strconcat(" (", msg, ")", NULL);
@@ -420,8 +425,18 @@
else {
for (i = 0; i < 10; i++) {
*fd = net_listen(ip, &port, 8);
- if (*fd != -1 || errno != EADDRINUSE)
+ if (*fd != -1)
break;
+ if (errno == EADDRINUSE) {
+ /* retry */
+ } else if (errno == EINTR &&
+ io_loop_is_running(ioloop)) {
+ /* SIGHUPing sometimes gets us here.
+ we don't want to die. */
+ } else {
+ /* error */
+ break;
+ }
check_conflicts(ip, port, *proto);
if (!retry)
More information about the dovecot-cvs
mailing list