Commit Diff


commit - d040746a37a2af87b1b4ffe746e2f3b9231576f1
commit + 5c4855299cc05b533c3b5229e864654f59fe69ea
blob - e092bb28c652be0f85dcaee3b60fc7c0d039d2c4
blob + 788398de69111418d5d2d9b81f00c9e740b8cdb1
--- gmid.c
+++ gmid.c
@@ -41,7 +41,7 @@ struct vhosthead hosts;
 
 int sock4, sock6;
 
-struct imsgbuf logibuf, exibuf, servibuf[PROC_MAX];
+struct imsgbuf logibuf, servibuf[PROC_MAX];
 
 const char *config_path = "/etc/gmid.conf";
 const char *pidfile;
@@ -390,9 +390,9 @@ serve(void)
 			fatal("fork: %s", strerror(errno));
 		case 0:		/* child */
 			close(p[0]);
-			imsg_init(&exibuf, p[1]);
+			imsg_init(&servibuf[i], p[1]);
 			setproctitle("server");
-			_exit(listener_main(&exibuf));
+			_exit(listener_main(&servibuf[i]));
 		default:
 			close(p[1]);
 			imsg_init(&servibuf[i], p[0]);
@@ -561,11 +561,15 @@ main(int argc, char **argv)
 			sock6 = make_socket(conf.port, AF_INET6);
 	}
 
-	imsg_compose(&exibuf, IMSG_QUIT, 0, 0, -1, NULL, 0);
-	imsg_flush(&exibuf);
+	for (i = 0; i < conf.prefork; ++i) {
+		imsg_compose(&servibuf[i], IMSG_QUIT, 0, 0, -1, NULL, 0);
+		imsg_flush(&servibuf[i]);
+		close(servibuf[i].fd);
+	}
 
 	imsg_compose(&logibuf, IMSG_QUIT, 0, 0, -1, NULL, 0);
 	imsg_flush(&logibuf);
+	close(logibuf.fd);
 
 	if (pidfd != -1)
 		close(pidfd);
blob - 7ffc94167bd434f8674d1670cc90dd7b66647bca
blob + 7595d3f13e263ae022d1bc7732c9823cc373bc1e
--- gmid.h
+++ gmid.h
@@ -205,7 +205,7 @@ struct conf {
 extern const char *config_path;
 extern struct conf conf;
 
-extern struct imsgbuf logibuf, exibuf, servibuf[PROC_MAX];
+extern struct imsgbuf logibuf, servibuf[PROC_MAX];
 
 extern int servpipes[PROC_MAX];