index c79259e401c0786bb80336601208b058180e23e9..77f3c8346498c430be10fcbafcf1ab9a06ee5cc2 100644 (file)
sdb_strbuf_t *recv_buf;
const char *result;
uint32_t rcode = 0;
+ int status = 0;
recv_buf = sdb_strbuf_create(1024);
if (! recv_buf)
return -1;
- if (sdb_client_recv(client, &rcode, recv_buf) < 0)
+ if (sdb_client_recv(client, &rcode, recv_buf) < 0) {
rcode = UINT32_MAX;
+ status = -1;
+ }
if (sdb_client_eof(client))
return -1;
+ if (rcode == CONNECTION_ERROR)
+ status = 1;
+
if (rcode == UINT32_MAX)
printf("ERROR: ");
result = sdb_strbuf_string(recv_buf);
}
sdb_strbuf_destroy(recv_buf);
- return 0;
+ return status;
} /* sdb_command_print_reply */
char *
/* ignore errors; we'll only hide the command from the caller */
sdb_client_send(input->client, CONNECTION_QUERY, query_len, query);
- if (sdb_command_print_reply(input->client))
+ if (sdb_command_print_reply(input->client) < 0)
return NULL;
}