Code

sysdb: When handling a reply, base further actions on the response code.
[sysdb.git] / src / tools / sysdb / command.c
index 7cbde41a7e05e1bff9f6c3f0dfd5d966dda62e8f..be41b15f9d92557588df6b9fefc326a261a80844 100644 (file)
@@ -58,19 +58,19 @@ sdb_command_print_reply(sdb_client_t *client)
        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 = CONNECTION_ERROR;
-
-       if (rcode == UINT32_MAX)
+       if (rcode == UINT32_MAX) {
                printf("ERROR: ");
+               status = -1;
+       }
+       else
+               status = (int)rcode;
+
        result = sdb_strbuf_string(recv_buf);
        if (result && *result)
                printf("%s\n", result);