summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 457ae8f)
raw | patch | inline | side by side (parent: 457ae8f)
author | Sebastian Harl <sh@tokkee.org> | |
Thu, 23 Jan 2014 08:12:47 +0000 (09:12 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Thu, 23 Jan 2014 08:12:47 +0000 (09:12 +0100) |
src/client/sock.c | patch | blob | history | |
src/tools/sysdb/command.c | patch | blob | history |
diff --git a/src/client/sock.c b/src/client/sock.c
index a2417ad6d872029e8c80f51d83899b65e9026a06..c722addb16d011355526d2b661919075601a28f8 100644 (file)
--- a/src/client/sock.c
+++ b/src/client/sock.c
size_t data_offset = sdb_strbuf_len(buf);
+ if (code)
+ *code = UINT32_MAX;
+
if ((! client) || (! client->fd) || (! buf)) {
errno = EBADF;
return -1;
}
- if (code)
- *code = UINT32_MAX;
-
while (42) {
ssize_t status;
index 30e6419e334d1b105749db8861826f2adf5f2883..f948d3aed65a5c18c78565819bdfac522b1cbe37 100644 (file)
#include "tools/sysdb/input.h"
#include "frontend/proto.h"
+#include "utils/error.h"
#include "utils/strbuf.h"
+#include <errno.h>
+
#include <assert.h>
#include <ctype.h>
#include <string.h>
if (query_len) {
sdb_strbuf_t *recv_buf;
+ const char *result;
uint32_t rcode = 0;
recv_buf = sdb_strbuf_create(1024);
if (rcode == UINT32_MAX)
printf("ERROR: ");
- printf("%s\n", sdb_strbuf_string(recv_buf));
+ result = sdb_strbuf_string(recv_buf);
+ if (result && *result)
+ printf("%s\n", result);
+ else if (rcode == UINT32_MAX) {
+ char errbuf[1024];
+ printf("%s\n", sdb_strerror(errno, errbuf, sizeof(errbuf)));
+ }
sdb_strbuf_destroy(recv_buf);
}