[dovecot-cvs] dovecot/src/master login-process.c, 1.73.2.12, 1.73.2.13 login-process.h, 1.7.2.2, 1.7.2.3 main.c, 1.80.2.12, 1.80.2.13

tss at dovecot.org tss at dovecot.org
Sat Oct 14 00:50:40 UTC 2006


Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv7492

Modified Files:
      Tag: branch_1_0
	login-process.c login-process.h main.c 
Log Message:
Reference counter fixes



Index: login-process.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/login-process.c,v
retrieving revision 1.73.2.12
retrieving revision 1.73.2.13
diff -u -d -r1.73.2.12 -r1.73.2.13
--- login-process.c	13 Oct 2006 23:10:15 -0000	1.73.2.12
+++ login-process.c	13 Oct 2006 23:50:07 -0000	1.73.2.13
@@ -439,7 +439,7 @@
 
 	p = i_new(struct login_process, 1);
 	p->group = group;
-	p->refcount = 1;
+	p->refcount = 2; /* once for fd close, another for process exit */
 	p->pid = pid;
 	p->fd = fd;
 	p->io = io_add(fd, IO_READ, login_process_input, p);
@@ -487,10 +487,12 @@
 
 	if (p->inetd_child)
 		login_process_exited(p);
+	login_process_unref(p);
 }
 
 static void login_process_unref(struct login_process *p)
 {
+	i_assert(p->refcount > 0);
 	if (--p->refcount > 0)
 		return;
 
@@ -689,20 +691,17 @@
 			p->group->wanted_processes_count = 0;
 	}
 
-	login_process_destroy(p);
 	login_process_exited(p);
 }
 
-void login_processes_destroy_all(bool unref)
+void login_processes_destroy_all(void)
 {
 	struct hash_iterate_context *iter;
 	void *key, *value;
 
 	iter = hash_iterate_init(processes);
-	while (hash_iterate(iter, &key, &value)) {
+	while (hash_iterate(iter, &key, &value))
 		login_process_destroy(value);
-		if (unref) login_process_unref(value);
-	}
 	hash_iterate_deinit(iter);
 
 	while (login_groups != NULL) {
@@ -893,7 +892,7 @@
 
 void login_processes_deinit(void)
 {
-        login_processes_destroy_all(TRUE);
+        login_processes_destroy_all();
 	hash_destroy(processes);
 
 	if (to != NULL)

Index: login-process.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/login-process.h,v
retrieving revision 1.7.2.2
retrieving revision 1.7.2.3
diff -u -d -r1.7.2.2 -r1.7.2.3
--- login-process.h	25 Sep 2006 12:07:11 -0000	1.7.2.2
+++ login-process.h	13 Oct 2006 23:50:07 -0000	1.7.2.3
@@ -20,7 +20,7 @@
 
 void login_process_destroyed(pid_t pid, bool abnormal_exit);
 
-void login_processes_destroy_all(bool unref);
+void login_processes_destroy_all(void);
 
 void login_processes_init(void);
 void login_processes_deinit(void);

Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/main.c,v
retrieving revision 1.80.2.12
retrieving revision 1.80.2.13
diff -u -d -r1.80.2.12 -r1.80.2.13
--- main.c	17 Aug 2006 18:17:38 -0000	1.80.2.12
+++ main.c	13 Oct 2006 23:50:07 -0000	1.80.2.13
@@ -135,7 +135,7 @@
 	i_warning("SIGHUP received - reloading configuration");
 
 	/* restart auth and login processes */
-        login_processes_destroy_all(FALSE);
+        login_processes_destroy_all();
         auth_processes_destroy_all();
         dict_process_kill();
 



More information about the dovecot-cvs mailing list