diff options
Diffstat (limited to 'src/run.c')
-rw-r--r-- | src/run.c | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -180,6 +180,21 @@ static int process_fifo(struct lt_config_app *cfg, struct lt_thread *t) return 0; } +static void cleanup_threads(struct lt_config_app *cfg) +{ + struct lt_thread *t = cfg->threads; + + while(t) { + struct lt_thread *tn; + + close(t->fifo_fd); + tn = t->next; + free(t); + t = tn; + } + cfg->threads = NULL; +} + static int process(struct lt_config_app *cfg, struct lt_process_args *pa) { int finish = 0, getin = 1, status; @@ -239,7 +254,7 @@ if (ret < 0) \ if (-1 == ret) { if (errno != EINTR) perror("select failed"); - return -1; + break; } CONTINUE_ZERO_RET(); @@ -293,6 +308,8 @@ if (ret < 0) \ #undef MAX } + cleanup_threads(cfg); + return status; } |