From d0ccf2269700ee4628ba542a4b435b6c6dc46d3e Mon Sep 17 00:00:00 2001 From: kanoi Date: Sun, 28 Dec 2014 16:57:55 +1100 Subject: [PATCH] ckdb - don't truncate large replies from cmd_userset() --- src/ckdb.h | 2 +- src/ckdb_cmd.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ckdb.h b/src/ckdb.h index a74f3bbe..fc1403c9 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -52,7 +52,7 @@ #define DB_VLOCK "1" #define DB_VERSION "0.9.6" -#define CKDB_VERSION DB_VERSION"-0.803" +#define CKDB_VERSION DB_VERSION"-0.804" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__ diff --git a/src/ckdb_cmd.c b/src/ckdb_cmd.c index 81546702..077d4050 100644 --- a/src/ckdb_cmd.c +++ b/src/ckdb_cmd.c @@ -173,6 +173,7 @@ static char *cmd_userset(PGconn *conn, char *cmd, char *id, USERS *users; char *reason = NULL; char *answer = NULL; + char *ret = NULL; size_t len, off; int32_t ratio; int rows, i; @@ -398,10 +399,12 @@ struckout: LOGERR("%s.%s.%s", cmd, id, reply); return strdup(reply); } - snprintf(reply, siz, "ok.%s", answer); - LOGDEBUG("%s.%s", id, answer); + APPEND_REALLOC_INIT(ret, off, len); + APPEND_REALLOC(ret, off, len, "ok."); + APPEND_REALLOC(ret, off, len, answer); free(answer); - return strdup(reply); + LOGDEBUG("%s.%s", id, ret); + return ret; } static char *cmd_workerset(PGconn *conn, char *cmd, char *id, tv_t *now,