summaryrefslogtreecommitdiff
path: root/items.c
diff options
context:
space:
mode:
Diffstat (limited to 'items.c')
-rw-r--r--items.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/items.c b/items.c
index fdfa38d..637e5e7 100644
--- a/items.c
+++ b/items.c
@@ -169,7 +169,11 @@ static size_t item_make_header(const uint8_t nkey, const unsigned int flags, con
/* suffix is defined at 40 chars elsewhere.. */
*nsuffix = (uint8_t) snprintf(suffix, 40, " %u %d\r\n", flags, nbytes - 2);
} else {
- *nsuffix = sizeof(flags);
+ if (flags == 0) {
+ *nsuffix = 0;
+ } else {
+ *nsuffix = sizeof(flags);
+ }
}
return sizeof(item) + nkey + *nsuffix + nbytes;
}
@@ -322,7 +326,7 @@ item *do_item_alloc(char *key, const size_t nkey, const unsigned int flags,
it->exptime = exptime;
if (settings.inline_ascii_response) {
memcpy(ITEM_suffix(it), suffix, (size_t)nsuffix);
- } else {
+ } else if (nsuffix > 0) {
memcpy(ITEM_suffix(it), &flags, sizeof(flags));
}
it->nsuffix = nsuffix;