aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/worker.c
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-05-15 17:18:22 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-05-15 17:18:22 +0200
commit871a7b0853eabe8d77a1aa6e866f6e3a804a2b77 (patch)
treeaf47f6617dde1d5e7b5f95560337e3376ec2b274 /src/worker.c
parentworker_queue: forgot to close file descriptors in worker_destroy (diff)
downloadcimple-871a7b0853eabe8d77a1aa6e866f6e3a804a2b77.tar.gz
cimple-871a7b0853eabe8d77a1aa6e866f6e3a804a2b77.zip
EINVAL means EINTR also?
Diffstat (limited to 'src/worker.c')
-rw-r--r--src/worker.c10
1 files changed, 8 insertions, 2 deletions
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: