aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/client.c')
-rw-r--r--src/client.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/client.c b/src/client.c
index be46ad1..c711235 100644
--- a/src/client.c
+++ b/src/client.c
@@ -21,12 +21,22 @@ void client_destroy(const struct client *client)
int client_main(const struct client *client, int argc, char *argv[])
{
- int result, ret = 0;
- struct msg msg = {argc, argv};
+ struct msg request = {argc, argv};
+ struct msg response;
+ int ret = 0;
- ret = msg_send_and_wait(client->fd, &msg, &result);
+ ret = msg_send_and_wait(client->fd, &request, &response);
if (ret < 0)
return ret;
- return result;
+ if (msg_is_error(&response)) {
+ print_error("Server failed to process the request\n");
+ ret = -1;
+ goto free_response;
+ }
+
+free_response:
+ msg_free(&response);
+
+ return ret;
}