diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2022-08-28 20:24:41 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2022-08-28 20:29:03 +0200 |
commit | 1c42eca6cdae99804b7020d89ae220308e4daff5 (patch) | |
tree | 62dc276ed87bf49dd186a6a3fdaff50f37d84700 /src/worker.c | |
parent | fix Alpine builds (diff) | |
download | cimple-1c42eca6cdae99804b7020d89ae220308e4daff5.tar.gz cimple-1c42eca6cdae99804b7020d89ae220308e4daff5.zip |
make proper "error" messages
Previously, the client had no way to distinguish errors from succesful
calls.
Diffstat (limited to '')
-rw-r--r-- | src/worker.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/worker.c b/src/worker.c index fbf609b..baba9b0 100644 --- a/src/worker.c +++ b/src/worker.c @@ -88,13 +88,19 @@ static int msg_ci_run_handler(struct worker *worker, const struct msg *request) int ret = 0; ret = msg_ci_run_do(request->argv[1], request->argv[2], &result); + proc_output_free(&result); + if (ret < 0) - msg_error(&response); + ret = msg_error(&response); else - msg_success(&response); - proc_output_free(&result); + ret = msg_success(&response); - return msg_send(worker->fd, &response); + if (ret < 0) + return ret; + + ret = msg_send(worker->fd, &response); + msg_free(&response); + return ret; } static int msg_ci_run_parser(const struct msg *msg) |