diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-05-15 17:18:22 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-05-15 17:18:22 +0200 |
commit | 871a7b0853eabe8d77a1aa6e866f6e3a804a2b77 (patch) | |
tree | af47f6617dde1d5e7b5f95560337e3376ec2b274 | |
parent | worker_queue: forgot to close file descriptors in worker_destroy (diff) | |
download | cimple-871a7b0853eabe8d77a1aa6e866f6e3a804a2b77.tar.gz cimple-871a7b0853eabe8d77a1aa6e866f6e3a804a2b77.zip |
EINVAL means EINTR also?
-rw-r--r-- | src/server.c | 2 | ||||
-rw-r--r-- | src/worker.c | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/server.c b/src/server.c index bf6a967..67f9e17 100644 --- a/src/server.c +++ b/src/server.c @@ -404,7 +404,7 @@ static int server_listen_thread(struct server *server) ret = tcp_server_accept(server->tcp_server, cmd_dispatcher_handle_conn, dispatcher); if (ret < 0) { - if (errno == EINVAL && global_stop_flag) + if ((errno == EINTR || errno == EINVAL) && global_stop_flag) ret = 0; goto dispatcher_destroy; } diff --git a/src/worker.c b/src/worker.c index 5762549..a316d7f 100644 --- a/src/worker.c +++ b/src/worker.c @@ -135,8 +135,11 @@ int worker_main(UNUSED struct worker *worker, const struct settings *settings) log("Waiting for a new command\n"); ret = worker_send_new_worker(settings, &task); - if (ret < 0) + if (ret < 0) { + if ((errno == EINTR || errno == EINVAL) && global_stop_flag) + ret = 0; goto dispatcher_destroy; + } while (!global_stop_flag) { struct msg *result = NULL; @@ -148,8 +151,11 @@ int worker_main(UNUSED struct worker *worker, const struct settings *settings) ret = worker_send_to_server(settings, result, &task); msg_free(result); - if (ret < 0) + if (ret < 0) { + if ((errno == EINTR || errno == EINVAL) && global_stop_flag) + ret = 0; goto dispatcher_destroy; + } } dispatcher_destroy: |