[dovecot-cvs] dovecot/src/imap client.c, 1.61, 1.62 client.h, 1.32, 1.33

cras at dovecot.org cras at dovecot.org
Sat Jan 14 16:51:32 EET 2006


Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv3322

Modified Files:
	client.c client.h 
Log Message:
Don't crash if closing with signal while IDLEing.



Index: client.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/client.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- client.c	14 Jan 2006 12:54:32 -0000	1.61
+++ client.c	14 Jan 2006 14:51:29 -0000	1.62
@@ -62,11 +62,16 @@
 {
 	int ret;
 
+	i_assert(!client->destroyed);
+	client->destroyed = TRUE;
+
 	if (client->command_pending) {
 		/* try to deinitialize the command */
 		i_assert(client->cmd.func != NULL);
 		i_stream_close(client->input);
 		o_stream_close(client->output);
+		client->input_pending = FALSE;
+
 		ret = client->cmd.func(&client->cmd);
 		i_assert(ret);
 	}
@@ -268,7 +273,7 @@
 	   pending and we should get around to calling client_input() soon.
 	   This is mostly for APPEND/IDLE. */
 	(void)i_stream_get_data(client->input, &size);
-	if (size > 0)
+	if (size > 0 && !client->destroyed)
 		client->input_pending = TRUE;
 }
 

Index: client.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/client.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- client.h	13 Jan 2006 20:25:59 -0000	1.32
+++ client.h	14 Jan 2006 14:51:29 -0000	1.33
@@ -46,6 +46,7 @@
 	struct imap_parser *parser;
 	struct client_command_context cmd;
 
+	unsigned int destroyed:1;
 	unsigned int command_pending:1;
 	unsigned int input_pending:1;
 	unsigned int output_pending:1;



More information about the dovecot-cvs mailing list