diff options
Diffstat (limited to 'src/server.c')
-rw-r--r-- | src/server.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/server.c b/src/server.c index 2fbb13c..da9cfc3 100644 --- a/src/server.c +++ b/src/server.c @@ -13,6 +13,7 @@ #include "file.h" #include "log.h" #include "msg.h" +#include "net.h" #include "process.h" #include "protocol.h" #include "run_queue.h" @@ -235,11 +236,12 @@ static int server_handle_cmd_new_worker(UNUSED const struct msg *request, if (ret < 0) return ret; + const int fd = ret; struct worker *worker = NULL; - ret = worker_create(&worker, ret); + ret = worker_create(&worker, fd); if (ret < 0) - return ret; + goto close; ret = server_enqueue_worker(server, worker); if (ret < 0) @@ -250,6 +252,9 @@ static int server_handle_cmd_new_worker(UNUSED const struct msg *request, destroy_worker: worker_destroy(worker); +close: + net_close(fd); + return ret; } |