about summary refs log tree commit homepage
path: root/exit.c
diff options
context:
space:
mode:
Diffstat (limited to 'exit.c')
-rw-r--r--exit.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/exit.c b/exit.c
index d558501..5f2a0a8 100644
--- a/exit.c
+++ b/exit.c
@@ -5,14 +5,17 @@
 #include "cmogstored.h"
 #include "nostd/setproctitle.h"
 
-static void acceptor_quit(int fd)
+static void acceptor_quit(int *fdp)
 {
+        int fd = *fdp;
+
         if (fd >= 0) {
                 struct mog_fd *mfd = mog_fd_get(fd);
                 struct mog_accept *ac = &mfd->as.accept;
 
                 mog_thrpool_quit(&ac->thrpool, NULL);
                 mog_fd_put(mfd);
+                *fdp = -1;
         }
 }
 
@@ -20,9 +23,9 @@ static bool svc_quit_accept_i(void *svcptr, void *ignored)
 {
         struct mog_svc *svc = svcptr;
 
-        acceptor_quit(svc->mgmt_fd);
-        acceptor_quit(svc->http_fd);
-        acceptor_quit(svc->httpget_fd);
+        acceptor_quit(&svc->mgmt_fd);
+        acceptor_quit(&svc->http_fd);
+        acceptor_quit(&svc->httpget_fd);
 
         return true;
 }