summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2023-04-20 21:19:05 -0700
committerdormando <dormando@rydia.net>2023-04-20 21:19:05 -0700
commit1e17c001682e4989db6458370a63a929ac0f107f (patch)
tree62d5cdef220311126bd586441beebd2ee9a35c81
parent8e1058b9380ffe045234fcbbd50554d615dca3b0 (diff)
downloadmemcached-1e17c001682e4989db6458370a63a929ac0f107f.tar.gz
proxy: don't print null ustats from "stats proxy"
If you had a numerical gap you would print junk.
-rw-r--r--proto_proxy.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/proto_proxy.c b/proto_proxy.c
index 2e1a2df..842f166 100644
--- a/proto_proxy.c
+++ b/proto_proxy.c
@@ -89,8 +89,10 @@ void process_proxy_stats(void *arg, ADD_STAT add_stats, conn *c) {
// return all of the user generated stats
for (int x = 0; x < us->num_stats; x++) {
- snprintf(key_str, STAT_KEY_LEN-1, "user_%s", us->names[x]);
- APPEND_STAT(key_str, "%llu", (unsigned long long)counters[x]);
+ if (us->names[x]) {
+ snprintf(key_str, STAT_KEY_LEN-1, "user_%s", us->names[x]);
+ APPEND_STAT(key_str, "%llu", (unsigned long long)counters[x]);
+ }
}
STAT_UL(ctx);