aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/server.c
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-08-28 20:24:41 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2022-08-28 20:29:03 +0200
commit1c42eca6cdae99804b7020d89ae220308e4daff5 (patch)
tree62dc276ed87bf49dd186a6a3fdaff50f37d84700 /src/server.c
parentfix Alpine builds (diff)
downloadcimple-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 'src/server.c')
-rw-r--r--src/server.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/server.c b/src/server.c
index a84016e..c2941c5 100644
--- a/src/server.c
+++ b/src/server.c
@@ -227,11 +227,16 @@ static int msg_ci_run_handler(struct server *server, int client_fd, const struct
ret = msg_ci_run_queue(server, msg->argv[1], msg->argv[2]);
if (ret < 0)
- msg_error(&response);
+ ret = msg_error(&response);
else
- msg_success(&response);
+ ret = msg_success(&response);
- return msg_send(client_fd, &response);
+ if (ret < 0)
+ return ret;
+
+ ret = msg_send(client_fd, &response);
+ msg_free(&response);
+ return ret;
}
static int msg_ci_run_parser(const struct msg *msg)