[dovecot-cvs] dovecot/src/master login-process.c, 1.85, 1.86 login-process.h, 1.9, 1.10 main.c, 1.92, 1.93

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


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

Modified Files:
	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.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- login-process.c	13 Oct 2006 23:10:17 -0000	1.85
+++ login-process.c	13 Oct 2006 23:50:09 -0000	1.86
@@ -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.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- login-process.h	25 Sep 2006 12:07:12 -0000	1.9
+++ login-process.h	13 Oct 2006 23:50:10 -0000	1.10
@@ -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.92
retrieving revision 1.93
diff -u -d -r1.92 -r1.93
--- main.c	17 Aug 2006 18:17:38 -0000	1.92
+++ main.c	13 Oct 2006 23:50:10 -0000	1.93
@@ -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